TypeScript 7 is the compiler rewritten in Go, and Microsoft says it's about 10× faster. So I tested it: the same real project on the same Mac, TypeScript 6 versus 7. Here are the numbers, how to upgrade, and the one thing that broke.
Video version:
What changed
- The compiler was ported from TypeScript to Go. Before,
tscwas JavaScript running on Node; now it's native code that type-checks on multiple threads. - It's still the same
typescriptnpm package and the sametsccommand. - The language didn't change. Your types mean the same thing.
- TypeScript 6.0 was the last JavaScript-based version, a bridge release that deprecated the options 7.0 removes.
The test
-
Project: Hono, a popular web framework known for heavy, complex types. I used two of its configs:
tsconfig.build.json(source only) andtsconfig.spec.json(source + tests, 908 files loaded). - Machine: Apple M4, 24 GB RAM.
-
Versions:
typescript@6.0.3vstypescript@7.0.2, installed side by side. -
Method:
tsc -p <config> --noEmit. Hono usescompositebuilds, so I deleted every.tsbuildinfobefore each run to keep runs cold. Five runs each; I report the median. Memory is the peak resident size from/usr/bin/time -l.
find . -name '*.tsbuildinfo' -not -path './node_modules/*' -delete
/usr/bin/time -l ../ts6/node_modules/.bin/tsc -p tsconfig.spec.json --noEmit
The results
| TS 6.0.3 | TS 7.0.2 | Speedup | |
|---|---|---|---|
| Source only | 1.44 s | 0.28 s | 5.1× |
| Source + tests | 4.39 s | 0.69 s | 6.4× |
| Peak memory (source + tests) | 890 MB | 758 MB | 15% less |
TS 7 with --singleThreaded
|
1.17 s | 3.7× |
The raw runs for source + tests: TS 6 took 4.58, 4.36, 4.39, 4.34 and 4.53 s; TS 7 took 0.68, 0.74, 0.69, 0.72 and 0.69 s.
So it's not quite 10× on this project, but 6.4× is huge. Even with multi-threading turned off (--singleThreaded), TS 7 was 3.7× faster, just from being native code. Your speedup depends on the project's size, its types and your CPU cores. Bigger projects and slower CI machines usually gain more.
--extendedDiagnostics showed where the time goes. TS 6 spent 3.61 s of its 4.28 s in the checker; TS 7 did the same check in 0.57 s.
How to upgrade
npm install -D typescript@7
npx tsc -v # Version 7.0.2
npx tsc --noEmit # same command as before
Your tsconfig.json stays the same, as long as you've fixed the deprecation warnings from TypeScript 6. Options deprecated in 6.0 are removed in 7.0. Upgrade to 6 first, fix the warnings, then move to 7.
What broke: the same error, on a different line
TypeScript 6 type-checked Hono's tests with 0 errors. TypeScript 7 found 4:
src/hono.test.ts(3522,3): error TS2578: Unused '@ts-expect-error' directive.
src/hono.test.ts(3525,5): error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type 'string' is not assignable to parameter of type 'string[]'.
These aren't new bugs. The test expects a type error (that's why it has // @ts-expect-error), and both versions find it. But TS 7 reports it on a different line: inside the call, rather than on the line the comment covers. So the comment becomes "unused", which is an error of its own, and the real error is no longer suppressed.
If your tests use @ts-expect-error on multi-line expressions, run tsc after upgrading and move the comments where needed.
Should you upgrade?
- ✅ Apps and libraries that just run
tsc: yes. - ✅ Big monorepos, slow CI, a laggy editor: this is where it pays off most.
- ⚠️ Fix TypeScript 6 deprecation warnings first.
- ⚠️ Tools that import
typescriptas a library (some bundler loaders and linters): TS 7.0 doesn't ship the full programmatic API yet; it's planned for 7.1. Check your toolchain before switching. - ⚠️ Check your
@ts-expect-errorlines.
How long does tsc take on your project? Try 7 and share your before/after numbers. 👇
I post one tested coding tip every day on YouTube at Refactorly. The 30-second version of this one is here.
Top comments (0)