Skip to content

TypeScript9 min read

TypeScript 7 Migration Guide for React and Next.js

How to upgrade a React, Next.js or Vite project to TypeScript 7: the Go-based tsc, removed tsconfig options, tool compatibility and fixes for common errors.

To move a React, Next.js or Vite project to TypeScript 7, first upgrade to TypeScript 6.0 and clear every deprecation warning, then install typescript@^7 and run npx tsc --noEmit. TypeScript 7 is the same language with a new compiler written in Go, so most code compiles unchanged; what breaks is old tsconfig.json options and tools that import the TypeScript API. Plan for typescript-eslint and ts-jest to stay on 6.0 for now, using npm aliases so both versions live side by side.

This guide is the checklist I use on React projects. It assumes you already know the basics from TypeScript for React developers.

Key takeaways

  • TypeScript 7.0 went stable on July 8, 2026. The current release on npm is 7.0.2, and 7.1 is in beta.
  • The binary is still tsc. tsgo was only the preview name from @typescript/native-preview.
  • The TypeScript team reports full-build speedups of roughly 8x to 12x on large projects.
  • Everything deprecated in 6.0 is a hard error in 7.0: target: es5, moduleResolution: node/node10, baseUrl, downlevelIteration, AMD/UMD/System modules and more.
  • 7.0 ships no programmatic API. Tools that import "typescript", such as typescript-eslint and ts-jest, need 6.0 alongside it.
  • Next.js and Vite are fine: Next.js runs the tsc CLI during next build, and Vite never type checks.

What changed in TypeScript 7

TypeScript 7 is a native port of the compiler and language service, developed in the typescript-go repository and now shipped from the regular typescript package. The TypeScript 7.0 announcement lists full-build times for real projects, for example the VS Code codebase going from 125.7s to 10.6s and Playwright from 12.8s to 1.47s, with lower memory use in every listed project.

Three things matter most for a React codebase:

  1. Same type system, same tsc. The team says code that compiles cleanly on 6.0 (with stableTypeOrdering on and no ignoreDeprecations) should compile the same way on 7.0.
  2. Parallel checking. Type checking runs in 4 workers by default. The experimental --checkers flag changes that, --builders parallelises project references under --build, and --singleThreaded turns it off.
  3. No API yet. 7.0 does not expose the JavaScript compiler API. The team expects 7.1 to ship a new and different API, so any tool that loads TypeScript as a library has to wait.

The tsgo and tsc naming

During the preview you installed @typescript/native-preview and ran npx tsgo. That package still lists a tsgo binary on npm, but its last build is from July 2026. The stable package gives you tsc, and nightlies moved to typescript@next. If your scripts or CI still call tsgo, switch them back to tsc and remove the preview package.

Defaults and options that changed

TypeScript 6.0 was released as "a bridge between TypeScript 5.9 and 7.0". It changed defaults and deprecated old options, and 7.0 turns those deprecations into errors. This table is what you need to check in tsconfig.json:

Option In TypeScript 7 What to do
strict Defaults to true Set "strict": false explicitly only if you must
module Defaults to esnext amd, umd, system and none are errors; use esnext or preserve
target Defaults to the newest stable ES version es5 is an error
moduleResolution node/node10 and classic are errors Use bundler for Vite and Next.js, nodenext for Node packages
baseUrl Error Delete it and make paths relative, e.g. "./src/*"
types Defaults to [] List what you use: "node", "vite/client", "vitest/globals"
rootDir Defaults to the folder containing tsconfig.json Set "rootDir": "./src" if your output layout depends on it
esModuleInterop, allowSyntheticDefaultImports Can't be set to false Switch import * as x to default imports where needed
downlevelIteration Error Remove it
noUncheckedSideEffectImports Defaults to true Make sure bare imports like CSS files resolve
outFile Removed in 6.0 Use a bundler

Two syntax changes can also bite: import x from "./data.json" asserts { type: "json" } must become with { type: "json" }, and module Foo {} namespace declarations must become namespace Foo {}.

Check your tools before you upgrade

This is where most migrations stall. Here is the state of the common React tooling as of November 2026, from npm and the official docs:

Tool Works with TypeScript 7? Notes
Next.js 16 Yes next build runs the project-local tsc CLI by default
Vite 8 Yes Vite transpiles with Oxc and never type checks
Vitest Yes for running tests Tests are transpiled by Vite; --typecheck calls the tsc CLI
typescript-eslint 8.73 Not yet Peer range is typescript >=4.8.4 <6.1.0; an experimental backend targets 7.1 pre-releases
ts-jest 29.4 No Peer range is typescript >=4.3 <7
VS Code Yes, via extension Install the "TypeScript 7" extension (TypeScriptTeam.native-preview)

Next.js

The Next.js TypeScript docs say TypeScript 7 needs no extra config: next build uses the local tsc CLI by default, controlled by the experimental useTypeScriptCli option. Two side effects are worth knowing. Errors are printed as plain tsc output, without Next.js code frames, and the whole project in your tsconfig.json is checked, including test files. If you set useTypeScriptCli: false with TypeScript 7 installed, next build exits because there is no compiler API to load.

Vite

The Vite docs are clear that Vite "only performs transpilation on .ts files and does NOT perform type checking". So the compiler swap does not affect vite dev or vite build at all. Your "build": "tsc -b && vite build" script simply gets faster. Keep "isolatedModules": true, which Vite requires. If you are still choosing a setup, I compare the options in Vite vs Next.js vs React Router.

typescript-eslint and ts-jest

Both load TypeScript as a library, so they need 6.0. The TypeScript team publishes a compatibility package, @typescript/typescript6, for exactly this. Its recommended setup uses two npm aliases:

JSON
{
  "devDependencies": {
    "@typescript/native": "npm:typescript@^7.0.2",
    "typescript": "npm:@typescript/typescript6@^6.0.2"
  }
}

Anything that does import "typescript" (ESLint, ts-jest, ts-morph) gets 6.0, which also provides a tsc6 binary. npx tsc runs 7.0. For tests I would rather move off ts-jest entirely; Vitest or a Jest transformer that only strips types does not care which compiler you have.

Step-by-step upgrade

1. Get to TypeScript 6.0 with zero deprecation warnings

Terminal
npm install -D typescript@^6.0.3
npx tsc --noEmit

If 6.0 reports deprecations, fix them now rather than silencing them with "ignoreDeprecations": "6.0". That setting only buys time on 6.0; 7.0 treats the same options as errors. The TypeScript 6.0 announcement also mentions an experimental ts5to6 tool that can rewrite baseUrl and rootDir.

2. Clean up tsconfig.json

A typical older React config and the version that works on 7.0:

JSON
{
  "compilerOptions": {
    "target": "es5",
    "moduleResolution": "node",
    "baseUrl": ".",
    "paths": { "@/*": ["src/*"] },
    "downlevelIteration": true
  }
}
JSON
{
  "compilerOptions": {
    "target": "es2022",
    "module": "esnext",
    "moduleResolution": "bundler",
    "jsx": "react-jsx",
    "isolatedModules": true,
    "skipLibCheck": true,
    "noEmit": true,
    "types": ["vite/client"],
    "paths": { "@/*": ["./src/*"] }
  },
  "include": ["src"]
}

The target here only affects type checking, because Vite or Next.js does the actual transpiling. Swap "vite/client" for whatever global types your project uses. A Next.js app gets its types through next-env.d.ts in include, so it usually needs "node" at most.

3. Install TypeScript 7

For a project with no ESLint type-aware rules and no ts-jest:

Terminal
npm install -D typescript@^7
npx tsc --noEmit

If you use typescript-eslint or ts-jest, use the alias setup from the previous section instead. Then remove @typescript/native-preview if you trialled it, and replace any tsgo calls in package.json scripts and CI with tsc.

4. Switch your editor

In VS Code, install the "TypeScript 7" extension. The announcement says it becomes the default language server, and you can toggle it with the "Disable/Enable TypeScript 7 Language Server" commands if something looks off.

5. Tune CI

Since checking is parallel by default, a small CI runner can be slower or run out of memory. Try npx tsc --noEmit --checkers 2 on 2-core machines and compare timings before settling.

Common TypeScript 7 errors and fixes

Error you see Cause Fix
Cannot find name 'process' or 'describe' types now defaults to [] Add "node", "vitest/globals" or "jest" to types
Cannot find module '@/components/...' baseUrl removed, paths were relative to it Prefix each paths entry with ./
Option moduleResolution=node10 errors Deprecated in 6.0, removed in 7.0 Use bundler
Option target=ES5 errors Same Use es2022 or newer and let the bundler handle browsers
Error on import './index.css' noUncheckedSideEffectImports is on Load the bundler's client types or add declare module '*.css' {}
Files written to dist/src/... rootDir default changed Set "rootDir": "./src"
ESLint crashes or npm install fails with a peer conflict typescript-eslint needs 6.0 Use the @typescript/typescript6 alias
Tests fail to transform ts-jest needs TypeScript below 7 Alias 6.0 or move to Vitest
New strict errors everywhere strict now defaults to true Fix them, or set "strict": false while you work through them

Template literal types also changed slightly: inference now treats a code point like an emoji as one unit instead of two UTF-16 halves. That only matters if you wrote type-level string length helpers.

Is it worth upgrading now?

For type checking, yes. The speedup shows up in CI, in pre-commit hooks and in the editor, and the migration cost is mostly config that 6.0 already warned you about. The awkward part is running two compilers until typescript-eslint and friends move to the 7.1 API. If your project uses Vue, Svelte, Astro or MDX tooling, the announcement says to stay on 6.0 for now.

If you are also upgrading React and its types, pair this with the React 19 hooks guide, since useRef and ref callback types changed in that release too.

FAQ

Is TypeScript 7 stable?

Yes. TypeScript 7.0 was announced as stable on July 8, 2026, and 7.0.2 is the latest version on npm. It is a native port of the compiler written in Go, installed from the same typescript package as before.

Is the TypeScript 7 command tsc or tsgo?

It is tsc. The tsgo binary came from the @typescript/native-preview package used during the preview. The stable release ships a normal tsc executable in the typescript package, and nightlies now come from typescript@next.

Does typescript-eslint work with TypeScript 7?

Not directly yet. TypeScript 7.0 ships without a programmatic API, and typescript-eslint still declares a peer range below TypeScript 6.1. Keep the typescript package aliased to @typescript/typescript6 for ESLint and install 7.0 under the @typescript/native alias for tsc.

Does Next.js support TypeScript 7?

Yes, for builds. Current Next.js 16 docs say next build runs the project-local tsc CLI by default instead of the compiler API, so TypeScript 7 works with no extra config. Diagnostics come straight from tsc without Next.js code frames.

Should I upgrade to TypeScript 6.0 before 7.0?

Yes. The TypeScript team recommends it. Options deprecated in 6.0, such as target ES5, moduleResolution node10 and baseUrl, become hard errors in 7.0, so fixing the 6.0 warnings first makes the 7.0 switch mostly a package bump.

Wrapping up

TypeScript 7 is the rare major version where the language barely moves and the tooling story is the whole migration. Get clean on 6.0, delete baseUrl and the ES5 era settings, list your types explicitly, and keep a 6.0 alias around for ESLint and ts-jest. After that, npx tsc is just faster.

  • #typescript
  • #react
  • #nextjs
  • #vite
  • #migration