Move a production TypeScript 6.0 codebase onto TypeScript 7 (the Go-based native compiler) without disrupting CI, editor tooling, or the existing type-check of record. TypeScript 7.0 went stable on July 8, 2026 and now ships as the regular typescript package with a tsc binary, so the old tsgo beta entry point is gone. The cutover keeps TypeScript 6.0 installed next to it as tsc6, so you can revert in a single command.
Target audience: application and platform teams already on TypeScript 6.0 with strict enabled. Affected tooling: the local typecheck script, CI typecheck job, editor language server, and any build tool that shells out to tsc. TypeScript 7.0 ships without a programmatic API, so anything that imports from typescript (typescript-eslint, ts-jest, ts-loader, ts-node) keeps running on 6.0 for now. Vue, Svelte, Astro and MDX editor tooling also still needs 6.0; see Step 6.
Prerequisites
- Node.js 16.20 or later (
[email protected]declaresnode >=16.20.0); the CI example below uses Node 22 - A project on TypeScript 6.0 that already compiles cleanly with
tsc --noEmit - No usage of
ignoreDeprecationsintsconfig.json - CI permissions to add a new job and modify the existing typecheck job
- A feature branch and a green main branch to compare against
If you are still on TypeScript 5.x, upgrade to 6.0 first and resolve any stableTypeOrdering diagnostics. The TypeScript team's 7.0 release notes say code that compiles cleanly under 6.0 with stableTypeOrdering on and no ignoreDeprecations should compile identically in 7.0. Everything 6.0 deprecated is a hard error in 7.0: target: es5, downlevelIteration, moduleResolution: node/node10/classic, baseUrl, and module set to amd, umd, systemjs or none among them.
Step 1. Capture a baseline from the current compiler
Purpose: lock in the diagnostic set produced by TypeScript 6.0 so you can diff it against the TypeScript 7 output.
git switch -c ts7-migration
npx tsc --noEmit --pretty false 2>&1 | tee baseline-tsc6.log
echo "exit=${PIPESTATUS[0]}" >> baseline-tsc6.logExpected result:
- Exit code 0 written to the end of
baseline-tsc6.log(PIPESTATUS[0]records the compiler's exit code, nottee's) - File committed or stashed so it survives the next steps
Recovery note: if the baseline is not clean on TS 6.0, stop here and fix the existing errors before installing TypeScript 7.
Step 2. Install TypeScript 7 alongside TS 6.0
Purpose: get the TypeScript 7 tsc on the project without losing 6.0. The @typescript/typescript6 compatibility package ships 6.0 under a tsc6 binary and re-exports the 6.0 API, so tools that import typescript through peer dependencies keep working. This is the alias setup from the 7.0 release notes:
{
"devDependencies": {
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2"
}
}Reinstall after editing package.json:
rm -rf node_modules
npm installExpected result:
npx tsc --versionreports a 7.0 versionnpx tsc6 --versionreports a 6.0 version- No peer-dependency warnings about TypeScript versions
Coming from the beta: if you followed an earlier version of this guide, remove @typescript/native-preview and replace tsgo with tsc in your scripts. That package was the beta and nightly channel; nightlies now publish as typescript@next.
Recovery note: if a transitive dependency pulls in a different typescript version, set the alias under overrides instead of devDependencies so the resolution is enforced for the whole tree.
Step 3. Run TypeScript 7 against the existing tsconfig
Purpose: confirm parity with the TS 6.0 baseline before any tsconfig changes.
time npx tsc --noEmit --pretty false 2>&1 | tee baseline-tsc7.log
echo "exit=${PIPESTATUS[0]}" >> baseline-tsc7.log
diff -u baseline-tsc6.log baseline-tsc7.log || trueExpected result:
tsc(7.0) exits 0- Diff against the TS 6.0 log is empty or limited to formatting and ordering of identical diagnostics
- Wall-clock time printed by
timeis materially lower than the 6.0 run on the same tree
If the diff contains new errors, check them against the documented 6.0 to 7.0 differences first: template literal inference now splits strings by Unicode code point, and JSDoc-typed JavaScript files lost several Closure-era patterns (@enum, @class, Closure function syntax). The team tracks these in CHANGES.md. Anything not listed there is a regression: file an issue at microsoft/typescript-go with a minimal repro and proceed only after triage.
Recovery note: if the compiler crashes (panic, segfault), capture the stderr and roll back via the rollback section. Do not paper over a crash by deleting node_modules/.cache.
Step 4. Add a parallel npm script, do not replace the existing one
Purpose: expose TypeScript 7 as a sibling script so contributors can opt in locally while CI still gates on 6.0. After Step 2, the 6.0 compiler answers to tsc6, so the authoritative script points there.
{
"scripts": {
"typecheck": "tsc6 --noEmit",
"typecheck:next": "tsc --noEmit"
}
}Expected result:
npm run typecheckstill uses TS 6.0 and is the authoritative checknpm run typecheck:nextruns TypeScript 7 and returns the same exit code on a clean tree
Recovery note: do not rename the existing script - downstream tooling and pre-commit hooks reference it by name.
Step 5. Wire TypeScript 7 into CI as a non-blocking canary
Purpose: collect parity data across real PRs before making TypeScript 7 the gate.
# .github/workflows/ci.yml
jobs:
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: "22" }
- run: npm ci
- run: npm run typecheck
typecheck-next:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: "22" }
- run: npm ci
- run: npm run typecheck:nextExpected result:
- Both jobs appear on every PR
typecheck-nextfailures do not block merges (continue-on-error: true)typecheck-nextwall-clock is visibly shorter thantypecheckon the same commit
TypeScript 7 type-checks with 4 parallel workers by default, set with the new --checkers flag. The release notes suggest lowering it on small CI runners, and note that in rare cases a different checker count can surface order-dependent results. If CI and laptops disagree, pin the same --checkers value in typecheck:next everywhere. --singleThreaded turns parallelism off entirely for debugging.
Recovery note: if the canary job is noisy enough to confuse reviewers, disable the workflow rather than removing the dependency.
Step 6. Switch editors to the TypeScript 7 language server
Purpose: surface TypeScript 7 diagnostics inside the editor so authors hit the new compiler before pushing.
- In VS Code, install the TypeScript 7 extension published by Microsoft. Once installed it becomes the default TypeScript experience; you do not need to disable the built-in extension.
- To switch back at any time, run Disable TypeScript 7 Language Server from the command palette (Enable TypeScript 7 Language Server turns it back on).
- In Visual Studio, the latest version enables TypeScript 7 automatically based on your workspace.
Expected result:
- Hover, go-to-definition, and quick-fix work on a representative file
- Project-wide errors panel matches the CLI output from
tsc --noEmit
Framework caveat: Vue, Svelte, Astro and MDX workflows embed TypeScript through its API (Volar, for example), so they still need TypeScript 6.0 in the editor. Angular projects can use TypeScript 7 for the CLI type-check and 6.0 for editor support. TypeScript 7.1, in beta since October 20, 2026, adds content mappers aimed at these file types; until it ships stable, keep those projects on the 6.0 language server.
Recovery note: TypeScript 7.0 has no programmatic API. 7.1 introduces a new and different one. Tools such as typescript-eslint, ts-jest, ts-loader and ts-node still need the TS 6.0 install you preserved under the typescript alias - do not uninstall it.
Step 7. Bake parity, then promote TypeScript 7 to the gating job
Purpose: only flip the gate after sustained parity, not after a single green build.
- Wait for at least two weeks and 50 merged PRs of
typecheckandtypecheck-nextagreeing on every commit. - Record any commit where they disagreed and confirm it was triaged.
- Once stable, swap the scripts:
{
"scripts": {
"typecheck": "tsc --noEmit",
"typecheck:legacy": "tsc6 --noEmit"
}
}Update the CI workflow so typecheck runs TypeScript 7 and the legacy job is the non-blocking canary. Leave the @typescript/typescript6 alias in place until every programmatic-API consumer supports the TypeScript 7.1 API.
Recovery note: keep the legacy job non-blocking but visible. If a regression slips through, you want one click to flip the gate back without a code change.
Verify
npx tsc --noEmit(7.0) exits 0 on a clean checkout of the migration branchnpx tsc6 --noEmitstill exits 0 with the same diagnostic count- CI shows both jobs green on three consecutive merges
- Editor go-to-definition resolves across a workspace import (cross-package, not just same-file)
- Watch a noisy directory (
npx tsc --watch) and confirm rebuilds happen on save. 7.0 rebuilt--watchon a Go port of Parcel's file watcher, so this is worth checking on your largest package
Rollback
Rollback removes TypeScript 7 entirely and returns the project to a plain TS 6.0 toolchain.
- Revert the
package.jsonscripts sotypecheckrunstsc --noEmitagain. - Remove TypeScript 7 and the 6.0 alias, then reinstall the regular 6.x package:
npm uninstall @typescript/native
npm install -D typescript@^6- Revert the CI workflow change that added the
typecheck-nextjob. - In VS Code, run Disable TypeScript 7 Language Server or uninstall the TypeScript 7 extension.
What rollback does NOT undo:
- Source edits made to satisfy TypeScript 7 diagnostics - those stay, and that is intentional
- New
baseline-tsc7.logandbaseline-tsc6.logartifacts in the repo - delete them manually - Cached language-service state in
.vscodeor per-developer settings - those are user-local
Irreversible: none of the steps in this guide are irreversible at the repository level. The only sticky change is editor extension state on individual machines.
What's next
Once TypeScript 7 is the gating compiler, audit the build tools that still depend on the TypeScript programmatic API and track their TypeScript 7.1 support. The missing 7.0 API is the main reason the 6.0 alias exists, and typed linting with typescript-eslint is usually the last consumer to move. When those tools support 7.1, drop the @typescript/typescript6 alias, remove @typescript/native, and depend on typescript 7.x directly. Add a CI step that prints tsc --version so version drift between developers and CI is observable.
