close

DEV Community

Cover image for Why Your TypeScript 7 Upgrade Broke ESLint, ts-jest, and ts-morph
Dev Encyclopedia
Dev Encyclopedia

Posted on

Why Your TypeScript 7 Upgrade Broke ESLint, ts-jest, and ts-morph

You installed TypeScript 7, ran your build, and something broke. Maybe ESLint crashed with a cryptic TypeError: Cannot read properties of undefined (reading 'Cjs'). Maybe ts-jest stopped transforming your test files. Maybe your CI pipeline just went red for no reason you can point to.

You're not doing anything wrong.

TypeScript 7 shipped tsgo, a genuine Go port of the type-checker, not a rewrite from scratch. But the tools that plug into TypeScript don't talk to the type-checker directly, they talk to a programmatic API. That API isn't stable yet, it lands in 7.1. Until then, a chunk of the ecosystem throws errors the moment you point typescript at the new version.

The 10-second version

Don't replace typescript in your dependencies with the 7.x line if you use typescript-eslint, ts-jest, ts-morph, or any tool doing programmatic type-checking. Keep typescript pinned to 6.x for those tools, and install @typescript/native-preview alongside it purely for fast type-checking in CI or a manual tsgo --noEmit command. Two compilers, living side by side, each doing a different job.

Why this is happening

The TypeScript team calls this Project Corsa: a line-by-line port of the compiler from the old JavaScript codebase (Strada) into Go (Corsa), preserving identical type-checking behavior while getting roughly 10x faster builds from real OS threads instead of Node's single-threaded event loop.

That preservation is impressive, but it's a port, not a reimplementation with a new API surface. Tools like typescript-eslint depend on the programmatic API to walk your AST and pull type information out of the compiler, and that API isn't ready until 7.1.

What's actually broken right now

typescript-eslint β€” npm refuses to install alongside typescript@7 at all (ERESOLVE error), because the published peer range only allows versions below 6.1.0. Force it through and ESLint crashes deep inside typescript-estree. Tracked as typescript-eslint issue #12518, closed as not planned since the real fix is on TypeScript's side.

ts-jest β€” Fine if typescript stays on 6.x in node_modules. Point ts-jest itself at @typescript/native-preview and it breaks, because it calls internal Strada APIs Corsa doesn't expose yet. Shows up as confusing transform failures, not install failures.

ts-morph and custom AST transformers β€” Same story: deep programmatic type introspection needs the 7.1 API. These tend to fail silently or produce subtly wrong output rather than crash outright, so audit before upgrading.

Monorepos with project references β€” The roughest edge. tsgo drops generic type parameters from JSDoc @typedef declarations using @template, and skipLibCheck: true doesn't suppress certain parse-level errors from third-party .d.ts files. A compatibility survey of 15 pipeline tools found 9 call Strada API functions that no longer exist.

The side-by-side fix

npm install -D typescript@^6.9
npm install -D @typescript/native-preview
Enter fullscreen mode Exit fullscreen mode
{
  "scripts": {
    "typecheck:fast": "tsgo --noEmit",
    "build": "tsc"
  }
}
Enter fullscreen mode Exit fullscreen mode

Run typecheck:fast as an early CI step, before your slower full build, and leave typescript-eslint's config untouched so it keeps resolving against your pinned 6.x install.

When to cut over

Wait for 7.1's stable programmatic API before dropping the side-by-side setup. If you're not using typescript-eslint, ts-morph, or custom transformers, and just run tsc for type-checking and emit, you can move to 7.0 as soon as it hits general availability. Most codebases aren't that lucky.

Full breakdown with the tool compatibility matrix, tsconfig defaults that changed, and an ERESOLVE fix generator: πŸ‘‰ Why Your TypeScript 7 Upgrade Broke ESLint, ts-jest, and ts-morph

Top comments (9)

Collapse
 
wrencalloway profile image
Wren Calloway

The version numbering here is going to bite people harder than the API break itself. There is no TypeScript 6.x line β€” the current stable is 5.x, and the Go port ships as @typescript/native-preview precisely because the team hasn't renamed anything to 7 yet. Pinning typescript@^6.9 will just fail to resolve, so anyone copy-pasting this fix lands in a worse state than they started. The correct mental model is: keep your normal typescript (5.x today) for everything programmatic, and add the native-preview package purely as a fast tsgo --noEmit gate.

That side-by-side split has a real trap the post doesn't mention: the two compilers can disagree, and the fast one is the one you're trusting in CI. If tsgo drops generic params from @template JSDoc β€” as you noted β€” then typecheck:fast can go green on code your actual tsc emit would reject, or vice versa. Running the port as an early gate is exactly the wrong place for it while behavior still diverges; you want the authoritative checker gating merges and the fast one as an advisory pre-filter, not the reverse.

Collapse
 
csm18 profile image
csm

Actually I think that the last stable version is 6.0.3, after which they jumped to numbering 7.0 to mark the go porting as major change!

Collapse
 
alexshev profile image
Alex Shev

Upgrade breakage like this is where ecosystem coupling becomes visible. TypeScript is not only a compiler in many codebases; it is also the contract for linting, tests, AST tooling, build plugins, and editor behavior. The safest migration plan audits those consumers before touching the version number.

Collapse
 
wrencalloway profile image
Wren Calloway

@csm18 That's not right, and it's worth being precise here because the whole upgrade path depends on it. The last stable TypeScript is on the 5.x line β€” 5.9 is the current release as I write this. There was never a 6.0.3; npm will happily tell you typescript@6.0.3 doesn't exist. The 6/7 confusion comes from the team's own roadmap language: they've said the Go port will land as TypeScript 6.x on the JS codebase first, then 7.0 once the native compiler is the default. But none of that has shipped under those numbers yet.

Right now the only way to touch the Go port is @typescript/native-preview, and your normal typescript stays 5.x. If you pin ^6.0.3 today, it fails to resolve β€” which is exactly the trap I was warning about. Happy to be corrected if you've got a source showing a real 6.0.3 tag, but I'd check the npm registry before trusting a number someone posted.

Collapse
 
csm18 profile image
csm

I don't know but here is my current tsc version that i installed with npm:

And the github screen shots:

Here is the link to github repo:
link

Collapse
 
wrencalloway profile image
Wren Calloway

You were right, and I was wrong. I relied on an outdated snapshot of the TypeScript roadmap and contradicted your actual installed version without checking the current releases first.
TypeScript 6.0.x has shipped, and TypeScript 7.0 has shipped as well. My claim that the current stable line was still 5.9, and that TS6/TS7 had not been released, was false. Sorry.
I did verify one narrower issue: the article’s typescript@^6.9 install command still needs correcting. TS6 is the 6.0.x bridge line, and the official TS7 guidance uses the @typescript/typescript6 compatibility package/alias alongside TS7.
So the article’s main point about API-dependent tooling needing TS6 during the TS7 transition is right; my correction of its release-state premise was not. Thank you for pushing back with evidence.

Thread Thread
 
csm18 profile image
csm

No problem πŸ‘

Collapse
 
svyatov profile image
Leonid Svyatov

The side-by-side framing is the right call, and the <6.1.0 peer range is exactly the thing to point people at, that's the part that bites first.

Worth adding for anyone setting this up now: you can skip @typescript/native-preview entirely. typescript@7.0.2 has been npm's latest since 8 July, and 7.0's own tsc is the Go binary. node_modules/typescript/lib/tsc.js is a 609-byte shim that execves the real executable out of @typescript/typescript-<platform>. So one install gets you both compilers:

npm i -D typescript@~6.0.3 typescript7@npm:typescript@7
# fast check: node_modules/typescript7/bin/tsc --noEmit
Enter fullscreen mode Exit fullscreen mode

Your "the API isn't stable yet" point is visible right in 7.0's exports map too, everything programmatic sits under ./unstable/*.

Collapse
 
frank_signorini profile image
Frank

I'm curious if the `isolated