Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions scopes/typescript/typescript/typescript.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,23 @@ export class TypescriptMain {
const configMutator = new TypescriptConfigMutator(options);
const transformerContext: TsConfigTransformContext = {};
const afterMutation = runTransformersWithContext(configMutator.clone(), transformers, transformerContext);
// TS 6 flipped several defaults and turned legacy options into hard errors.
// Shipped env tsconfigs must stay valid for TS 5.x consumers, so patch the raw tsconfig
// at runtime when the loaded compiler is actually TS 6+ — preserving TS 5 behavior.
const tsMajor = parseInt(tsModule.version?.split('.')[0] || '0', 10);
const compilerOptions = afterMutation.raw.tsconfig?.compilerOptions;
if (tsMajor >= 6 && compilerOptions) {
if (!compilerOptions.ignoreDeprecations) compilerOptions.ignoreDeprecations = '6.0';
if (compilerOptions.strict === undefined) compilerOptions.strict = false;
if (compilerOptions.noUncheckedSideEffectImports === undefined)
compilerOptions.noUncheckedSideEffectImports = false;
// TS 6 stopped auto-discovering @types/* packages (types defaults to []).
// Seed the types every Bit env installs — @types/node universally and @types/jest
// (provides describe/it/expect globals). React env excludes @types/mocha, so don't seed it.
if (compilerOptions.types === undefined) {
compilerOptions.types = ['node', 'jest'];
}
}
const afterMutationWithoutTsconfig = { ...afterMutation.raw, tsconfig: '' };

return new TypescriptCompiler(
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"strict": true,
"moduleResolution": "node",
"module": "commonjs",
"ignoreDeprecations": "6.0",
"noUncheckedSideEffectImports": false,
"types": ["node", "mocha", "chai", "jest"],
"target": "es2015",
"skipLibCheck": true,
"noImplicitAny": false,
Expand Down
4 changes: 2 additions & 2 deletions workspace.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
"tippy.js": "6.2.7",
"ts-graphviz": "^2.1.6",
"type-coverage": "2.15.1",
"typescript": "5.9.2",
"typescript": "6.0.3",
Comment on lines 642 to +645
"ua-parser-js": "0.7.40",
"uid-number": "0.0.6",
"uniqid": "5.3.0",
Expand Down Expand Up @@ -834,7 +834,7 @@
"buffer": "6.0.3",
"process": "0.11.10",
"react-router-dom": "6.3.0",
"typescript": "5.9.2",
"typescript": "6.0.3",
// @parcel/css, lightningcss, @swc/css are used by css-minimizer-webpack-plugin
// see this issue https://github.com/webpack-contrib/css-minimizer-webpack-plugin/issues/244
"@parcel/css": "^1.8.3",
Expand Down