CodeSapient
โ† All articles

TypeScript 7 Migration: Upgrade Without Breaking Your Build

TypeScript 7's native compiler is much faster, but upgrading breaks old tsconfig options and type-aware ESLint. A tested migration path: clean up on TS 6, run both compilers, then switch.

By CodeSapient Labs ยท
Vintage walnut car dashboard with two chrome gauges labelled tsc 6 and tsc 7 showing build seconds, 10.1 and 1.8, a brass plate reading TypeScript 7 migration, and amber warning lamps for baseUrl, es5, node10, types and rootDir

You change one line in package.json, from TypeScript 6 to TypeScript 7, and the pipeline goes red in three places. npm install fails with ERESOLVE. tsc refuses to read your tsconfig.json because baseUrl "has been removed". And once you force the install through, ESLint crashes with "typescript-eslint does not support TS 7.0".

None of this means TypeScript 7 is unready. The new compiler is a native Go port, and on our test project it did a full build more than five times faster than TypeScript 6. But a TypeScript 7 migration is not a version bump. It is a config cleanup, a dependency split and a CI change. This guide walks through each step on a small lab project, with the real error messages we got from tsc 6.0.3 and 7.0.2 on 2 December 2026.

What changed in TypeScript 7

Microsoft released TypeScript 7.0 on 8 July 2026. It is a port of the compiler from TypeScript to Go, written to keep the same structure and results as the old codebase while adding native speed and shared-memory multithreading. The TypeScript team reports typical full-build speedups of 8x to 12x on large open source projects. At the time of writing, the latest tag on npm is 7.0.2, and TypeScript 7.1 is published as a beta.

Four facts from the announcement drive almost every migration decision:

  • The typescript package now installs the native compiler. npm install -D typescript gives you the Go-based tsc.
  • TypeScript 7.0 has no programmatic API. Anything that does import ts from "typescript" (type-aware linting, code generators, some build plugins) can't use it. A new, different API is planned for 7.1, and the 7.1 beta announcement shows it.
  • TypeScript 6 lives on as @typescript/typescript6. It provides a tsc6 binary and re-exports the 6.0 API, so both compilers can sit in one project.
  • Deprecations from 6.0 are now hard errors. TypeScript 7 adopts 6.0's new defaults and refuses the options 6.0 deprecated. If you skipped the TypeScript 6.0 changes, you are doing two upgrades at once.

The team also says that practically any code that compiles cleanly with TypeScript 6.0, with stableTypeOrdering on and no ignoreDeprecations set, should compile identically in 7.0. That gives you a clean migration order: get clean on 6, install 7 next to it, compare, then switch.

Check these blockers first

Before touching config, find out whether you can switch fully or only partly:

  • Type-aware ESLint. typescript-eslint 8.74.0, the version we installed, declares a peer dependency of typescript >=4.8.4 <6.1.0. Next.js projects get it through eslint-config-next, which depends on typescript-eslint. Support for newer versions is tracked in typescript-eslint issue #10940.
  • Embedded languages. The announcement says Vue, MDX, Astro and Svelte workflows need TypeScript 6.0 for now, because tools like Volar rely on the compiler API. Angular projects can use TypeScript 7 for command-line checks and TypeScript 6 for editor support.
  • Language server plugins. Until the new API lands, the announcement recommends TypeScript 7 only where language server plugins are not required. If your editor depends on one, keep TypeScript 6 there.
  • JavaScript projects checked through JSDoc. TypeScript 7 reworked JavaScript support. Patterns such as @enum, Closure-style function(string): void types and @class on functions are no longer specially recognised. Expect new errors if you use checkJs.

If none of these apply, you can move the whole project to TypeScript 7. If some do, you still get the fast tsc in CI by running both compilers side by side, which is what most of this guide sets up.

Step 1: Get clean on TypeScript 6

A common reason a TypeScript 7 upgrade fails is a deprecation that TypeScript 6 already reported but someone silenced with "ignoreDeprecations": "6.0". Remove that line and run TypeScript 6 first. Our lab started from a config that will look familiar in any project created a few years ago:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "baseUrl": "./src",
    "outDir": "dist",
    "downlevelIteration": true,
    "esModuleInterop": true,
    "skipLibCheck": true
  },
  "include": ["src"]
}

TypeScript 6.0.3 (npx tsc6 -p legacy --noEmit) lists every problem as a deprecation:

error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0.
error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0.
error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0.
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0.

TypeScript 7.0.2 reports the same four options as removed, and stops there:

error TS5108: Option 'target=ES5' has been removed. Please remove it from your configuration.
error TS5108: Option 'moduleResolution=node10' has been removed. Please remove it from your configuration.
error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration.
  Use '"paths": {"*": ["./src/*"]}' instead.
error TS5102: Option 'downlevelIteration' has been removed. Please remove it from your configuration.

The list matched exactly, so a clean TypeScript 6 run is a reliable to-do list for TypeScript 7.

Walnut dashboard panel titled tsconfig warning lights with ten lamps. Red lamps for options removed in TypeScript 7: target es5 to es2022 or later, moduleResolution node to bundler or nodenext, baseUrl to paths relative to tsconfig, downlevelIteration delete it, module amd umd system to esnext or preserve, esModuleInterop false delete it. Amber lamps for new defaults: types now empty so list the @types you need, rootDir now ./ so set rootDir to ./src, strict now true, noUncheckedSideEffectImports so add a declaration file for CSS imports
The tsconfig options TypeScript 7 rejects (red) and the 6.0 defaults it inherits (amber).

Choose replacements, don't just delete

  • target: es5 has no direct replacement. Pick the lowest runtime you actually ship to. If a bundler or Babel handles downlevelling for old browsers, es2022 or later is normal.
  • moduleResolution: node (also called node10) becomes bundler for code a bundler consumes (Vite, webpack, Next.js), or nodenext for code Node runs directly. nodenext requires file extensions on relative imports, so it can touch every import in a backend.
  • baseUrl becomes a paths entry relative to the tsconfig, as the error message suggests. The TypeScript 6.0 migration guide notes that if baseUrl was ., you can often just delete it.
  • downlevelIteration only mattered for ES5 and older output. Delete it.
  • module: amd, umd, systemjs or none become esnext or preserve with a bundler. commonjs is still accepted; our fixed config uses it.
  • esModuleInterop and allowSyntheticDefaultImports can no longer be set to false. Remove the lines and re-run the type check.

The two new defaults that surprise people

After removing the four options and adding paths, both compilers raised a new error we hadn't written any code to cause:

error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir'
setting must be explicitly set to this or another path to adjust your output's file layout.

rootDir now defaults to the folder containing tsconfig.json. Without an explicit setting, output that used to land in dist/api/server.js would move to dist/src/api/server.js, which breaks start scripts and Dockerfiles that point at the old path. Add "rootDir": "./src" if your sources live in src.

With that fixed, the next run found this:

src/api/server.ts(3,21): error TS2591: Cannot find name 'process'. Do you need to install
type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the
types field in your tsconfig.

@types/node was installed. The cause is that types now defaults to [], so packages under @types are no longer included automatically. List the ones you rely on, such as ["node"], ["node", "jest"] or ["vite/client"]. Setting ["*"] restores the old behaviour, but an explicit list is clearer.

The config that passed on both compilers:

{
  "compilerOptions": {
    "target": "es2022",
    "module": "commonjs",
    "paths": {
      "*": [
        "./src/*"
      ]
    },
    "outDir": "dist",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "rootDir": "./src",
    "types": [
      "node"
    ]
  },
  "include": [
    "src"
  ]
}

We compiled it with tsc6 and tsc into separate folders and diffed them: the emitted JavaScript was byte-for-byte identical. One thing paths does not do is rewrite imports. The emitted file still contains require("lib/money"), exactly as it did with baseUrl, so your bundler, NODE_PATH or package imports field still has to resolve it at runtime.

Step 2: Install TypeScript 7 next to TypeScript 6

The naive upgrade, "typescript": "7.0.2" alongside typescript-eslint, failed for us at install time:

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error Found: typescript@7.0.2
npm error Could not resolve dependency:
npm error peer typescript@">=4.8.4 <6.1.0" from typescript-eslint@8.74.0

Forcing it with --legacy-peer-deps only moves the failure to lint time. ESLint 9.39.5 stopped with Error: typescript-eslint does not support TS 7.0. The fix the TypeScript team recommends is npm aliases: keep the name typescript pointing at the TypeScript 6 compatibility package, so tools that import it get the 6.0 API, and install TypeScript 7 under another name:

{
  "devDependencies": {
    "@typescript/native": "npm:typescript@^7.0.2",
    "typescript": "npm:@typescript/typescript6@^6.0.2",
    "typescript-eslint": "^8.74.0"
  }
}

With that installed, npx tsc --version printed Version 7.0.2 and npx tsc6 --version printed Version 6.0.3. The compatibility package's own version is 6.0.2, and it pulls in TypeScript 6.0.3 underneath, so pin the range as ^6.0.2. Type-aware lint rules kept working: no-floating-promises and require-await both flagged a deliberately broken file.

Then make your scripts explicit about which compiler they mean:

{
  "scripts": {
    "typecheck": "tsc --noEmit",
    "typecheck:ts6": "tsc6 --noEmit --stableTypeOrdering",
    "build": "tsc -p tsconfig.build.json",
    "lint": "eslint ."
  }
}

Most React and Next.js apps don't use tsc to emit JavaScript at all; the bundler does that, and tsc --noEmit is a type-check gate in CI. That is the easiest place to start, and it is often where the time savings matter most. Framework upgrades tend to arrive together, so if you are also working through the React Compiler in Next.js or Next.js Cache Components, change one thing at a time so you know what caused a new error.

Step 3: Compare both compilers in CI

"Should compile identically" is a strong claim, and checking it on your own code costs one script. This one runs both compilers with --noEmit, keeps only file, position and error code (so a reworded message doesn't count as a difference) and fails if the sets differ:

#!/usr/bin/env bash
# Type-check one project with TypeScript 6 and 7 and fail if the diagnostics differ.
# Usage: ./compare-compilers.sh path/to/tsconfig.json
set -u
project=${1:-tsconfig.json}
bin=./node_modules/.bin
out=$(mktemp -d)

"$bin/tsc6" -p "$project" --noEmit --pretty false --stableTypeOrdering > "$out/ts6.txt"
"$bin/tsc"  -p "$project" --noEmit --pretty false > "$out/ts7.txt"

# Keep only "file(line,col): error TSxxxx" lines so wording changes don't count as differences.
for v in ts6 ts7; do
  grep -oE '^[^(]+\([0-9]+,[0-9]+\): error TS[0-9]+' "$out/$v.txt" | sort > "$out/$v.keys"
done

echo "TS6: $(wc -l < "$out/ts6.keys") errors, TS7: $(wc -l < "$out/ts7.keys") errors"
if diff -u "$out/ts6.keys" "$out/ts7.keys"; then
  echo "Same diagnostics from both compilers."
else
  echo "Diagnostics differ; review the lines above before switching."
  exit 1
fi

On our fixed project and on the 4,000-file benchmark below, it reported the same diagnostics from both compilers. To check it really catches differences, we fed it the change the announcement calls out for template literal types, which now split strings by Unicode code point instead of UTF-16 code unit:

type HeadTail<S> = S extends `${infer H}${infer T}` ? [H, T] : never;
type R = HeadTail<"๐Ÿ˜€abc">;
export const check: R = ["๐Ÿ˜€", "abc"];

TypeScript 6 reported two TS2322 errors, because it inferred half of a surrogate pair as the head. TypeScript 7 accepted the code, and the script failed as intended. Differences like this are rare, and usually sit in shared utility types such as type-level string length helpers.

Watch the exit code

With one type error and --noEmit, tsc6 exited with code 2 and tsc 7 exited with code 1. With emit enabled, both exited with 2. Most CI systems only check for non-zero, but a wrapper script that treats exit code 2 specially will behave differently.

Step 4: Measure and tune parallelism

TypeScript 7 parses, type-checks and emits in parallel. Three new flags control it:

  • --checkers sets the number of type-checker workers. The default is 4. More workers can speed up large projects but use more memory.
  • --builders sets how many project references build at once under --build. It multiplies with --checkers, so 4 builders with 4 checkers can mean 16 checkers.
  • --singleThreaded turns off parallelism entirely, which helps for debugging or very small CI runners.

The announcement notes that, in rare cases, changing --checkers can surface order-dependent results. Pick one value and use it on every machine, including CI and laptops.

We generated a synthetic project of 4,000 TypeScript files with interfaces, mapped and template literal types, generics and cross-file imports, then timed a full build with declarations (8,000 output files) three times per configuration on an 8 vCPU Linux box with Node.js 24.22.1:

  • TypeScript 6.0.3 (tsc6): median 10.08 s, peak memory 1,177 MB
  • TypeScript 7.0.2, default (4 checkers): median 1.77 s, peak memory 1,124 MB
  • TypeScript 7.0.2, --checkers 8: median 1.50 s, peak memory 1,227 MB
  • TypeScript 7.0.2, --checkers 1: median 3.82 s, peak memory 945 MB
  • TypeScript 7.0.2, --singleThreaded: median 4.43 s, peak memory 915 MB
Walnut dashboard with five cream gauges showing median full-build time for a synthetic 4,000-file TypeScript project: tsc 6 at 10.08 seconds, tsc 7 default at 1.77 seconds, tsc 7 with 8 checkers at 1.50 seconds, tsc 7 with 1 checker at 3.82 seconds and tsc 7 single-threaded at 4.43 seconds, with peak memory under each gauge and a note that the emitted output was identical
Our lab: same 4,000 files, same 8,000 output files, five compiler configurations.

The default TypeScript 7 build was about 5.7x faster than TypeScript 6 here. Even single-threaded, it finished in less than half the time. Peak memory was similar to TypeScript 6 at the default setting and rose a little with 8 checkers. The two compilers' output, all 8,000 .js and .d.ts files, was identical.

Treat these numbers as a sanity check, not a forecast. The code is generated rather than real, the box is shared with other work, and three runs is a small sample. The speedup on your codebase depends on its shape, and Microsoft's own figures are on real projects such as VS Code and Sentry. Time your own build with the default setting first, then try --checkers 2 on small CI runners and higher values on large machines.

Editor setup

TypeScript 7 ships a new language server built on the Language Server Protocol. In VS Code, the dedicated TypeScript 7 extension becomes the default once installed, and the "Disable TypeScript 7 Language Server" command switches back to TypeScript 6. For Vue, Svelte, Astro, MDX and Angular templates, keep the TypeScript 6 language service in the editor and use TypeScript 7 for tsc in CI.

Common mistakes

  • Upgrading with ignoreDeprecations still set. It hides the exact list of things TypeScript 7 will reject.
  • Replacing typescript outright in a project with type-aware linting. Install fails, or lint crashes once you force the install.
  • Forgetting rootDir. Output moves to dist/src and the app fails to start, often only in the Docker image.
  • Using "types": ["*"] everywhere to make errors go away. It works, but you lose the chance to stop test globals like describe leaking into application code.
  • Switching moduleResolution to nodenext on bundled frontend code. Use bundler there; nodenext is for code that Node runs directly.
  • Different --checkers values on different machines. Rare, but it can cause results that differ between CI and laptops.

Recommendations by project type

  • React or Next.js app with ESLint: use the alias setup, switch tsc --noEmit in CI to TypeScript 7, and leave linting on the TypeScript 6 API until typescript-eslint supports the new one.
  • Node.js API compiled with tsc: fix rootDir, types and moduleResolution first, diff the emitted output once, then build with TypeScript 7. If you are touching build tooling anyway, it is a good time to check your OpenTelemetry JavaScript setup still loads correctly after the module settings change.
  • Monorepo with project references: start with the default --checkers and add --builders gradually, watching memory on CI runners.
  • Vue, Svelte, Astro or MDX: stay on TypeScript 6 for editor and template checking; consider TypeScript 7 only for plain .ts packages in the repo.
  • Tools built on the compiler API: keep importing the TypeScript 6 API from the compatibility package, and evaluate the 7.1 API once it is stable. It is a different API, so plan a rewrite rather than an upgrade.

What we tested and what we didn't

Everything in the lab ran locally with TypeScript 7.0.2, TypeScript 6.0.3 (through @typescript/typescript6 6.0.2), typescript-eslint 8.74.0, ESLint 9.39.5 and Node.js 24.22.1. We tested the legacy and fixed configs on both compilers, the emit comparison, the ERESOLVE failure and the lint crash, type-aware linting through the alias, the comparison script on matching and differing code, exit codes, and the benchmark. We did not test a real Next.js, Angular or Vue application, editor integrations, --watch mode, --builders with project references, or the 7.1 beta API.

FAQ

Is TypeScript 7 ready for production?

It is the stable release on npm, and Microsoft says it was tested with many large teams before launch. The practical limit is ecosystem support for the missing API, not the compiler itself.

Does TypeScript 7 change the JavaScript it emits?

It shouldn't for code that compiles cleanly on 6.0 with stable type ordering. In our lab, all emitted files were identical. Diff your own output once to be sure.

When will typescript-eslint support TypeScript 7?

Its error message points to TypeScript 7.1, which introduces the new API, and progress is tracked in issue #10940. Until then, the alias setup lets you use both.

Conclusion

The faster compiler is the easy part of TypeScript 7. The work is in a config that has drifted for years, tools that still need the old API, and a CI pipeline that should prove both compilers agree before you trust the new one. Get clean on TypeScript 6, add the alias, run the comparison, then let TypeScript 7 take over the type-check step.

If your team runs a large TypeScript codebase and wants help planning the upgrade or speeding up CI, CodeSapient builds and maintains React, Next.js and Node.js applications. You can tell us about your project and we'll suggest an approach that fits it.

โ† Back to Blog