Repository navigation
chore: add TypeScript 7 side-by-side via @typescript/native alias and detect it in the LSP resolver - #153
Conversation
… detect it in the LSP resolver
Bump typescript ^5.7.0 to ^6.0.3 in the root package, packages/{logger,dora,code,lsp,
binaries,format} and hooks/scripts. typescript-eslint 8.x requires typescript below
6.1.0, and TypeScript 7 ships no classic JS API, so the classic line stays for tooling.
Add the root devDependency "@typescript/native": "npm:typescript@^7.0.2" and update
bun.lock.
In packages/lsp/src/server/typescript.ts, resolveNativeTypeScriptServer now detects a
TypeScript 7+ tsc under @typescript/native. It checks after a native typescript and
before the @typescript/native-preview tsgo.
Add two unit tests in packages/lsp/test/unit/typescript-native.test.ts, and document
the behavior in the apps/docs configuration overview and packages/lsp/CLAUDE.md.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request upgrades the workspace-wide TypeScript version from ^5.7.0 to ^6.0.3 and introduces support for Native TypeScript 7+ via the @typescript/native alias. It updates the LSP server resolution logic in packages/lsp/src/server/typescript.ts to detect and use this aliased binary, adds corresponding unit tests, and updates the documentation in overview.md and CLAUDE.md. There are no review comments to evaluate, and we have no further feedback to provide.
Aligns the docs site with the classic TypeScript line used by the rest of the workspace. The docs build fails the same way before and after this change (@vue/compiler-sfc cannot resolve NuxtLinkProps in docs-please UButton.vue).
|
[Medium impact] The change reaches workspace TypeScript tooling and projects using the TypeScript language server. Fix alias selection before merging so it works when classic TypeScript owns the shared
|
| const nativeAlias = findPackageBin(root, '@typescript/native', 'tsc', isNativeTypeScriptPackage) | ||
| if (nativeAlias) { return { command: nativeAlias, label: 'native tsc (@typescript/native)' } } |
There was a problem hiding this comment.
Installed native compiler is skipped
If the shared node_modules/.bin/tsc points to classic typescript, this lookup skips the installed @typescript/native alias. Both packages declare tsc, but findPackageBin accepts the alias only when the shared command points to its own executable. Users can therefore install both packages correctly and still get the classic language server.
Resolve the alias's declared executable without depending on which package owns the shared command. Add a test where classic typescript owns it.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/lsp/src/server/typescript.ts
Line: 172-173
Comment:
**Installed native compiler is skipped**
If the shared `node_modules/.bin/tsc` points to classic `typescript`, this lookup skips the installed `@typescript/native` alias. Both packages declare `tsc`, but `findPackageBin` accepts the alias only when the shared command points to its own executable. Users can therefore install both packages correctly and still get the classic language server.
Resolve the alias's declared executable without depending on which package owns the shared command. Add a test where classic `typescript` owns it.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.


Summary
Add TypeScript 7 next to TypeScript 6 and teach the LSP resolver to use it.
typescript@7.0.2ships onlylib/version.cjs(no classic JS API, notsserver.js), and typescript-eslint 8.73 peers ontypescript >=4.8.4 <6.1.0. Swappingtypescriptto 7 would therefore breakeslint .and the lint-staged pre-commit hook. Sotypescriptmoves to ^6.0.3 and TS 7 is installed under the@typescript/nativealias, the name the typescript-estree canary already declares as a peer.What changed
typescript^5.7.0 → ^6.0.3 in the root,packages/{logger,dora,code,lsp,binaries,format}andhooks/scripts; new root devDependency"@typescript/native": "npm:typescript@^7.0.2".resolveNativeTypeScriptServer(packages/lsp/src/server/typescript.ts) detects a TS 7+tscunder@typescript/native. It ranks after a nativetypescriptand before@typescript/native-previewtsgo, and skips an alias that is a classic build.packages/lsp/test/unit/typescript-native.test.ts; docs inapps/docs/content/docs/3.configuration/1.overview.mdandpackages/lsp/CLAUDE.md.Scope
apps/docsis bumped totypescript ^6.0.3as well. Out of scope:plugins/*,examples/*and test fixtures are not workspaces and were not touched.Blast radius
With bun's hoisted linker,
node_modules/.bin/tscnow links to TS 7, so any script that callstscgets 7.tsserverand the JS API stay on 6.0.3. Repo typecheck usesbun check, which is independent of both.Verification
bun run typecheck(7/7 tasks),bun run lintandbun run test(7/7 tasks; lsp 209 pass, code 100 pass) all pass.tsc --noEmit -p packages/lsp/tsconfig.jsonis clean under TS 7.0.2 and TS 6.0.3.code lspon a file with a deliberate type error loggedUsing native tsc (@typescript/native) language server (--lsp --stdio)and reported[2322] Type 'string' is not assignable to type 'number'.Related issue
None.
Checklist
bun run test)bun run lint)BREAKING CHANGE:note is includedSummary by cubic
Installs TypeScript 7 side-by-side with TypeScript 6 under the
@typescript/nativealias, since TS 7 ships no classic JS API and typescript-eslint 8.x requirestypescriptbelow 6.1.0. The LSP resolver now detects the aliased TS 7tscand uses it for native language server mode.typescriptfrom ^5.7.0 to ^6.0.3 across the root package,packages/{logger,dora,code,lsp,binaries,format},hooks/scripts, andapps/docs; adds@typescript/nativeas a root devDependency.resolveNativeTypeScriptServerpicks a TS 7+tscunder@typescript/native, ranking after a nativetypescriptand before the@typescript/native-previewtsgo, and skips aliases that point at classic builds.node_modules/.bin/tscnow links to TS 7 for any repo script;tsserver, the JS API, andbun checkunaffected.plugins/*,examples/*, and test fixtures were not touched;apps/docskeeps a classic build it still needs, now aligned to ^6.0.3.Written for commit 7734bbc. Summary will update on new commits.