build: support TypeScript 7 with native declaration emit - #12101
Timothee Guerin (timotheeguerin) wants to merge 4 commits into
Conversation
|
You can try these changes here
|
@typespec/compiler
@typespec/html-program-viewer
@typespec/http-server-csharp
@typespec/http-server-js
@typespec/playground
commit: |
|
All changed packages have been documented.
Show changes
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new catalog dependency breaks nested-workspace installation, and regenerated TypeKit signatures are malformed.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Enables native TypeScript 7 compilation while retaining TypeScript 6’s JavaScript API for tooling.
Changes:
- Replaces Vite declaration plugins with native
tscemit. - Adds TS6 compatibility and TS7 native compiler aliases.
- Updates generated dependencies, documentation, and build compatibility fixes.
| File | Description |
|---|---|
package.json |
Adds the native compiler dependency. |
pnpm-workspace.yaml |
Defines compiler aliases and Alloy extension. |
pnpm-lock.yaml |
Updates resolved dependencies. |
CONTRIBUTING.md |
Documents the dual-compiler setup. |
packages/compiler/tsconfig.json |
Limits compiler project inputs. |
packages/compiler/tsconfig.build.json |
Inherits the shared input configuration. |
packages/compiler/src/server/server.ts |
Types custom request results. |
packages/typespec-vscode/src/tsp-language-client.ts |
Types chat request results. |
packages/react-components/package.json |
Adds native declaration scripts. |
packages/react-components/tsconfig.declaration.json |
Configures declaration emit. |
packages/react-components/vite.config.ts |
Removes the declaration plugin. |
packages/html-program-viewer/package.json |
Adds native declaration scripts. |
packages/html-program-viewer/tsconfig.declaration.json |
Configures declaration emit. |
packages/html-program-viewer/vite.config.ts |
Removes the declaration plugin. |
packages/playground/package.json |
Adds native declaration scripts. |
packages/playground/tsconfig.declaration.json |
Configures declaration emit. |
packages/playground/vite.config.ts |
Removes the declaration plugin. |
packages/playground/src/react/playground.tsx |
Keeps CSS out of declarations. |
packages/playground/src/react/typespec-editor.tsx |
Keeps CSS out of declarations. |
packages/playground/src/react/output-view/type-graph-viewer.tsx |
Keeps CSS out of declarations. |
packages/playground/src/react/viewers/swagger-ui.tsx |
Keeps CSS out of declarations. |
packages/playground-website/package.json |
Adds native declaration generation. |
packages/playground-website/tsconfig.declaration.json |
Configures library declarations. |
packages/playground-website/vite.lib.config.ts |
Removes the declaration plugin. |
packages/spec-dashboard/package.json |
Adds native declaration scripts. |
packages/spec-dashboard/tsconfig.declaration.json |
Configures declaration emit. |
packages/spec-dashboard/vite.config.ts |
Removes the declaration plugin. |
packages/http-server-js/build-helpers.ts |
Resolves generated projects to TS7. |
packages/http-server-js/generated-defs/package.json.ts |
Updates generated TS dependency. |
packages/http-server-csharp/test/snapshot.test.ts |
Ignores .NET build artifacts. |
website/src/content/docs/docs/standard-library/reference/typekits.mdx |
Regenerates TypeKit references. |
.chronus/changes/build-native-typescript-declarations-2026-9-2-18-10-52.md |
Records Vite package changes. |
.chronus/changes/build-native-typescript-declarations-2026-9-2-18-11-49.md |
Records compiler and editor changes. |
.chronus/changes/build-native-typescript-declarations-2026-9-2-18-38-25.md |
Records tooling changes. |
.chronus/changes/build-native-typescript-declarations-2026-9-2-18-38-27.md |
Records generated server dependency update. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "rimraf": "catalog:", | ||
| "turbo": "catalog:", | ||
| "typescript": "catalog:", | ||
| "typescript-native": "catalog:", |
| typedoc-plugin-markdown: ^4.12.0 | ||
| typescript: ~6.0.2 | ||
| typescript: npm:@typescript/typescript6@~6.0.2 | ||
| typescript-native: npm:typescript@~7.0.2 |


Upgrading to TypeScript 7 currently fails when Vite loads
vite-plugin-dts, which requires the JavaScript compiler API that the native compiler no longer provides.Use native
tscdeclaration emit for the five Vite libraries instead. Vite continues to build JS/CSS, followed by per-file declarations at the existing package export paths. Library watch mode runs both processes without deleting declarations on Vite rebuilds, and runtime CSS imports stay out of the type declarations.The catalog aliases
typescriptto@typescript/typescript6for the JavaScript compiler API andtsc6. A root-onlytypescript-nativedependency aliases TypeScript 7.0.2 and providestscto existing package scripts. No pnpm hook or per-package compiler dependency changes are needed. A declarative package extension gives Alloy's CLI native TypeScript because it resolvestypescript/bin/tscdirectly. Tools and editor integrations importingtypescriptcontinue to see TS6.CI build performance
These measurements were captured before the compatibility-alias follow-up; fresh CI measurements are needed to confirm the final setup.
Comparing the TS6 run at the PR's base commit with the first TS7 run, cumulative build time across the six matrix jobs dropped from 15m 48s to 10m 39s: 33% less build time, saving 5m 09s of runner time.
These measurements cover the successful
pnpm buildsteps only, excluding queueing, setup, installation, and tests; some TS7 jobs were later cancelled during tests by subsequent pushes. The Ubuntu / Node 24 logs show the same runner image and 0/48 cached tasks in both runs. This is a single-run comparison, not an isolated compiler benchmark or a total CI turnaround measurement. A subsequent TS7 run recorded Windows builds of 2m 37s, 2m 02s, and 2m 00s for Node 22, 24, and 26, respectively, showing run-to-run variation.