Skip to content

Inconsistent typescript rules between custom environment compiler and build task #8889

Open
@sbland

Description

Describe the bug

I have a custom react environment which mostly inherited from @bitdev/react.react-env.

When I run bit check-types or bit compile it has no errors but when I run bit snap -b I get typescript errors. It appears that the check-types function is not running in strict mode but the build pipeline is.

I.e. the compile pipeline doesn't enforce implicit any so the following code pases

function hello(foo)  {
  console.info(foo)
}

but with the build pipeline I would get the error error TS7006: Parameter 'foo' implicitly has an 'any' type.

The tsconfig.json looks like this:

{
  "extends": "@teambit/react.react-env/config/tsconfig.json",
  "exclude": ["artifacts", "public", "dist", "node_modules", "package.json", "**/*.cjs"],
  "include": ["**/*", "**/*.json"]
}

.bit.env.ts file

...

  compiler(): EnvHandler<Compiler> {
    return TypescriptCompiler.from({
      tsconfig: this.tsconfigPath,
      types: resolveTypes(__dirname, [this.tsTypesPath]),
      typescript,
    });
  }


  build() {
    return Pipeline.from([
      TypescriptTask.from({
        tsconfig: this.tsconfigPath,
        types: resolveTypes(__dirname, [this.tsTypesPath]),
        typescript,
      }),
      EslintTask.from({
        eslint: ESLintLib,
        tsconfig: this.tsconfigPath,
        configPath: this.eslintConfigPath,
        pluginsPath: __dirname,
        extensions: this.eslintExtensions,
      }),
      VitestTask.from({
        config: require.resolve('./config/vitest.config.mjs'),
      }),
    ]);
  }

Expected Behavior

bit check-types should fail as strict: true is in the tsconfig

Specifications

  • Bit version:1.6.145
  • Workspace type: harmony/
  • Node version: v18.19.1
  • npm / yarn version: 10.2.4
  • Platform: ubuntu

for harmony workspace

  • relevant env @bitdev/react.react-env.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions