-
Notifications
You must be signed in to change notification settings - Fork 956
chore(deps): upgrade typescript 5.9.2 to 6.0.3 #10326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
126ece2
5c031ca
3e148a8
4a6123a
9f88d1f
d5c323d
eb32bb3
03fcd93
e9be3ab
54adc51
65a0c2d
b9843d1
e77c301
40de25a
6d1e4bc
28795ff
e43c83d
325d82f
3ca3c27
3a9ce91
fbd8b13
3ab3b28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,6 +130,33 @@ 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 tsconfig = afterMutation.raw.tsconfig; | ||
| const compilerOptions = tsconfig?.compilerOptions; | ||
| if (tsMajor >= 6 && compilerOptions) { | ||
| // TODO(ts7): `ignoreDeprecations: "6.0"` is a temporary bridge that silences the | ||
| // deprecation diagnostics TS 6 emits to prepare users for TS 7 (e.g., `moduleResolution: "node"`). | ||
| // It can't be hardcoded in the env tsconfig JSON files because TS 5.x consumers would | ||
| // reject the "6.0" value (TS5103), so we inject it conditionally here. Migrate env tsconfigs | ||
| // off the deprecated options (moduleResolution → node16/bundler) before adopting TS 7. | ||
| if (!compilerOptions.ignoreDeprecations) compilerOptions.ignoreDeprecations = '6.0'; | ||
| if (compilerOptions.noUncheckedSideEffectImports === undefined) | ||
| compilerOptions.noUncheckedSideEffectImports = false; | ||
| // strict and types: don't inject when the tsconfig extends a base — the base may | ||
| // already set these, and an explicit value here would silently override the inherited one. | ||
| if (!tsconfig.extends) { | ||
| if (compilerOptions.strict === undefined) compilerOptions.strict = 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). Don't seed 'mocha': the React env | ||
| // removes @types/mocha via the `-` convention (see react.env.ts), so seeding it | ||
| // would make tsc fail to resolve a type package that isn't installed. | ||
| if (compilerOptions.types === undefined) compilerOptions.types = ['node', 'jest']; | ||
| } | ||
|
Comment on lines
+148
to
+158
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Ts6 patch skips extends TypescriptMain.createCompiler() only injects TS6-compat defaults for strict/types when tsconfig.extends is falsy, so configs that extend a base can still pick up TS6’s new defaults. React env’s typescript/tsconfig.cjs.json extends typescript/tsconfig.json (which doesn’t set strict/types), so TS6 can treat it as strict-by-default with no auto-discovered @types, causing IDE/tsserver errors and mismatches vs Bit’s compiler behavior. Agent Prompt
Comment on lines
+150
to
+158
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Mocha types excluded TypescriptMain.createCompiler() injects compilerOptions.types = ['node','jest'] for TS 6 when types is unset, which prevents @types/mocha from contributing ambient globals even if it’s installed. Repo spec files rely on mocha globals (e.g. after()), so TS6 compilation/typecheck paths using this injected config will fail with missing global names. Agent Prompt
|
||
| } | ||
| const afterMutationWithoutTsconfig = { ...afterMutation.raw, tsconfig: '' }; | ||
|
|
||
| return new TypescriptCompiler( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.