Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
126ece2
chore(deps): upgrade typescript 5.9.2 to 6.0.3
davidfirst Apr 22, 2026
5c031ca
Merge branch 'master' into upgrade-typescript-6
davidfirst Apr 22, 2026
3e148a8
fix(typescript): restore TS 5 defaults for strict and noUncheckedSide…
davidfirst Apr 22, 2026
4a6123a
Merge remote-tracking branch 'origin/master' into upgrade-typescript-6
davidfirst Apr 24, 2026
9f88d1f
fix(typescript): seed default compilerOptions.types on TS 6
davidfirst Apr 24, 2026
d5c323d
Merge branch 'master' into upgrade-typescript-6
davidfirst Apr 28, 2026
eb32bb3
fix(typescript): address copilot review
davidfirst Apr 28, 2026
03fcd93
test(e2e): make permissive tsconfig fixture set strict explicitly
davidfirst Apr 30, 2026
e9be3ab
chore: revert pnpm-lock.yaml to match master
davidfirst Apr 30, 2026
54adc51
Merge branch 'master' into upgrade-typescript-6
davidfirst Apr 30, 2026
65a0c2d
chore(deps): align @types/jest to jest 29 major
davidfirst May 1, 2026
b9843d1
fix(typescript): preserve TS 5 strict default for inferred ts-server …
davidfirst May 11, 2026
e77c301
Merge remote-tracking branch 'origin' into upgrade-typescript-6
davidfirst May 11, 2026
40de25a
docs(typescript): clarify why 'mocha' isn't seeded in TS 6 types defa…
davidfirst May 13, 2026
6d1e4bc
docs(e2e): fix misleading TS 6 strict-default comment in fixture
davidfirst May 13, 2026
28795ff
fix(typescript): await tsserver start() before issuing requests in init
davidfirst May 13, 2026
e43c83d
Merge remote-tracking branch 'origin/master' into upgrade-typescript-6
davidfirst Jun 3, 2026
325d82f
fix(typescript): rethrow ts-server init() failures instead of silentl…
davidfirst Jun 3, 2026
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
6 changes: 4 additions & 2 deletions e2e/harmony/tsconfig-env-mismatch.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ describe('tsconfig env mismatch between check-types and build', function () {
before(() => {
helper.scopeHelper.setWorkspaceWithRemoteScope();

// Create permissive tsconfig (no strict mode)
// Create permissive tsconfig (strict mode explicitly off).
// Setting strict explicitly makes the fixture's intent self-documenting and
// independent of any future change to TypeScript's tsconfig defaults.
const permissiveTsconfig = JSON.stringify(
{
compilerOptions: {
Expand All @@ -55,7 +57,7 @@ describe('tsconfig env mismatch between check-types and build', function () {
moduleResolution: 'node',
esModuleInterop: true,
outDir: './dist',
// No strict mode - permissive
strict: false,
},
exclude: ['artifacts', 'public', 'dist', 'node_modules'],
},
Expand Down
31 changes: 23 additions & 8 deletions scopes/typescript/ts-server/ts-server-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ export class TsserverClient {
onEvent: this.onTsserverEvent.bind(this),
});

this.tsServer
.start()
.then(() => {
this.serverRunning = true;
})
.catch((err) => {
this.logger.error('TsserverClient.init failed', err);
});
// Await the server to be ready before issuing any requests, so a start() failure
// (e.g., tsserver writing to stderr) surfaces here rather than producing a write to a
// broken stdin, and so the inferred-project options below are applied to a live server.
await this.tsServer.start();
this.serverRunning = true;

// TS 6 flipped the `strict` default from false to true for inferred projects.
// Files outside any tsconfig (e.g., components whose env's tsconfig isn't included
// by the workspace config writer) would otherwise get strict-mode errors that didn't
// surface in TS 5. Pin inferred-project options to the TS 5 default to preserve behavior.
await this.setCompilerOptionsForInferredProjects({ strict: false });
Comment thread
davidfirst marked this conversation as resolved.

const shouldOpenFiles = this.options.openFilesOnInit !== false;
if (this.files.length && shouldOpenFiles) {
Expand All @@ -89,7 +92,13 @@ export class TsserverClient {
}
this.logger.debug('TsserverClient.init completed');
} catch (err) {
// Rethrow so callers know the server didn't come up. Swallowing here would leave
// `this.tsServer` set but unusable, and subsequent `request()` calls would silently
// return undefined via optional chaining — producing false-clean check-types runs.
this.logger.error('TsserverClient.init failed', err);
this.tsServer = null;
this.serverRunning = false;
throw err;
}
}

Expand Down Expand Up @@ -296,6 +305,12 @@ export class TsserverClient {
return this.tsServer?.request(CommandTypes.Configure, configureArgs);
}

private async setCompilerOptionsForInferredProjects(
options: ts.server.protocol.ExternalProjectCompilerOptions
): Promise<void> {
await this.tsServer?.request(CommandTypes.CompilerOptionsForInferredProjects, { options });
}

/**
* ask tsserver to open a file if it was not opened before.
* @param file absolute path of the file
Expand Down
22 changes: 22 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,28 @@ 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) {
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'];
}
}
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
5 changes: 3 additions & 2 deletions workspace.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"@types/lodash.flatten": "4.4.6",
"@types/lodash.head": "4.0.6",
"@types/mdx-js__react": "1.5.5",
"@types/jest": "29.5.14",
"@types/memoizee": "0.4.5",
"@types/mime": "2.0.3",
"@types/mini-css-extract-plugin": "2.2.0",
Expand Down Expand Up @@ -643,7 +644,7 @@
"tippy.js": "6.2.7",
"ts-graphviz": "^2.1.6",
"type-coverage": "2.15.1",
Comment thread
davidfirst marked this conversation as resolved.
"typescript": "5.9.2",
"typescript": "6.0.3",
Comment thread
davidfirst marked this conversation as resolved.
"ua-parser-js": "0.7.40",
"uid-number": "0.0.6",
"uniqid": "5.3.0",
Expand Down Expand Up @@ -838,7 +839,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