Skip to content

build: support TypeScript 7 with native declaration emit - #12101

Draft
Timothee Guerin (timotheeguerin) wants to merge 4 commits into
microsoft:mainfrom
timotheeguerin:build/native-typescript-declarations
Draft

Timothee Guerin (timotheeguerin) wants to merge 4 commits into
microsoft:mainfrom
timotheeguerin:build/native-typescript-declarations

Conversation

@timotheeguerin

@timotheeguerin Timothee Guerin (timotheeguerin) commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

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 tsc declaration 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 typescript to @typescript/typescript6 for the JavaScript compiler API and tsc6. A root-only typescript-native dependency aliases TypeScript 7.0.2 and provides tsc to 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 resolves typescript/bin/tsc directly. Tools and editor integrations importing typescript continue 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.

Runner TS6 build TS7 build Change
Ubuntu / Node 22 2m 56s 1m 39s 44% less
Ubuntu / Node 24 1m 58s 1m 21s 31% less
Ubuntu / Node 26 2m 34s 1m 33s 40% less
Windows / Node 22 3m 12s 2m 28s 23% less
Windows / Node 24 3m 11s 1m 37s 49% less
Windows / Node 26 1m 57s 2m 01s 3% more

These measurements cover the successful pnpm build steps 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.

@microsoft-github-policy-service microsoft-github-policy-service Bot added compiler:core Issues for @typespec/compiler ide Issues for VS, VSCode, Monaco, etc. eng ui:playground ui:type-graph-viewer labels Oct 2, 2026
@azure-sdk-automation

azure-sdk-automation Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@pkg-pr-new

pkg-pr-new Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@typespec/compiler

npm i https://pkg.pr.new/@typespec/compiler@12101

@typespec/html-program-viewer

npm i https://pkg.pr.new/@typespec/html-program-viewer@12101

@typespec/http-server-csharp

npm i https://pkg.pr.new/@typespec/http-server-csharp@12101

@typespec/http-server-js

npm i https://pkg.pr.new/@typespec/http-server-js@12101

@typespec/playground

npm i https://pkg.pr.new/@typespec/playground@12101

commit: 5ba4585

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • ✅ @typespec/compiler
  • ✅ @typespec/html-program-viewer
  • ✅ @typespec/http-server-js
  • ✅ @typespec/playground
  • ✅ typespec-vscode
Show changes

@typespec/react-components - internal ✏️

Generate Vite library declarations with the native TypeScript 7 CLI instead of a plugin using the JavaScript compiler API.

@typespec/html-program-viewer - internal ✏️

Generate Vite library declarations with the native TypeScript 7 CLI instead of a plugin using the JavaScript compiler API.

@typespec/playground - internal ✏️

Generate Vite library declarations with the native TypeScript 7 CLI instead of a plugin using the JavaScript compiler API.

@typespec/playground-website - internal ✏️

Generate Vite library declarations with the native TypeScript 7 CLI instead of a plugin using the JavaScript compiler API.

@typespec/spec-dashboard - internal ✏️

Generate Vite library declarations with the native TypeScript 7 CLI instead of a plugin using the JavaScript compiler API.

@typespec/compiler - internal ✏️

Support TypeScript 7 builds by explicitly typing custom language-server request results and limiting the compiler project to its source and test inputs.

typespec-vscode - internal ✏️

Support TypeScript 7 builds by explicitly typing custom language-server request results and limiting the compiler project to its source and test inputs.

@typespec/tspd - internal ✏️

Use native TypeScript 7 for workspace compilation while providing the TypeScript 6 JavaScript compiler API through the @typescript/typescript6 compatibility alias for documentation tooling.

@typespec/astro-utils - internal ✏️

Use native TypeScript 7 for workspace compilation while providing the TypeScript 6 JavaScript compiler API through the @typescript/typescript6 compatibility alias for documentation tooling.

@typespec/website - internal ✏️

Use native TypeScript 7 for workspace compilation while providing the TypeScript 6 JavaScript compiler API through the @typescript/typescript6 compatibility alias for documentation tooling.

@typespec/http-server-js - dependencies ✏️

Update the generated server's TypeScript dependency to version 7.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the meta:website TypeSpec.io updates label Oct 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:core Issues for @typespec/compiler eng ide Issues for VS, VSCode, Monaco, etc. meta:website TypeSpec.io updates ui:playground ui:type-graph-viewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant