跪拜 Guibai
← All articles
Backend · Node.js · TypeScript

TypeScript 7.0's Go Rewrite Cuts Compile Times by 9x and Breaks Five Things

By 独立开发阿平 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

A 9x compile-speed improvement and 70% memory reduction change what's practical in CI, editor feedback, and monorepo scale. The migration breaks existing builds through tightened defaults, not syntax incompatibility, so teams need a concrete rollback plan before upgrading.

Summary

The TypeScript team shipped a full compiler rewrite in Go, codenamed Project Corsa, that moves type checking from a single-threaded JavaScript program to a multi-threaded native binary. Real-world benchmarks on a mid-size project show cold-start compilation dropping from 45.8 seconds to 5.1 seconds and memory usage falling from 2.4 GB to 680 MB. Editor responsiveness improves to the 80-120 ms range.

The upgrade is not a drop-in replacement. Three default configuration changes—`alwaysStrict: true`, `types: []`, and `noUncheckedSideEffectImports: true`—trigger cascading errors in existing codebases. Import assertions using the `assert` keyword are deprecated in favor of `with`, and legacy `namespace`-wrapping-`module` patterns are rejected outright. A gradual migration strategy that isolates low-dependency modules first, combined with a two-phase tsconfig approach, keeps the upgrade manageable.

Syntax and semantics remain 100% compatible with TS6, so the migration cost is a one-time error cleanup rather than a rewrite. The payoff is a compiler that scales across cores, shrinks CI feedback loops, and resets the floor for front-end tooling performance.

Takeaways
TS7.0 is a full Go rewrite of the compiler (Project Corsa), not an incremental release.
Cold-start compilation on a mid-size project dropped from 45.8 s to 5.1 s, a 9x improvement.
Memory usage fell from 2.4 GB to 680 MB on the same codebase.
Three default config changes break existing projects: `alwaysStrict: true`, `types: []`, and `noUncheckedSideEffectImports: true`.
`types: []` means no `@types/*` packages are auto-loaded; global types like `process` and `jest` disappear until explicitly listed.
Import assertions using `assert` are deprecated; the ECMAScript-standard `with` keyword replaces them.
Nesting `module` inside `namespace` is now an error; use `namespace` throughout.
Older build tooling (ts-loader, gulp plugins) may need upgrades or workarounds like `skipLibCheck`.
A gradual migration strategy—isolating low-dependency modules first—prevents a big-bang breakage.
Enabling `incremental` and `composite` after migration extracts further speed gains from parallel project-reference builds.
Conclusions

The 100% syntax compatibility claim is technically true but misleading in practice: the tightened defaults create a wave of configuration-driven errors that feel like breaking changes.

Moving the compiler to Go shifts the performance bottleneck from single-core JavaScript execution to the number of available CPU cores, which fundamentally changes the economics of large monorepos.

The `types: []` default is the most disruptive single change because it silently removes global types that developers assume are always present, and the fix requires knowing which `@types` packages each global came from.

Editor responsiveness dropping to 80-120 ms from 1-2 seconds is arguably more valuable than the cold-start number, because it changes the felt experience of writing TypeScript all day.

The two-phase tsconfig approach—temporarily reverting strict defaults to get compiling, then restoring them after cleanup—is a practical pattern that the official migration docs underplay.

Concepts & terms
Project Corsa
The internal codename for TypeScript 7.0's ground-up rewrite of the compiler in Go, replacing the original 14-year-old JavaScript implementation to enable native multi-threading and machine-code execution.
Unicode codepoint preservation in template literal types
TS7 parses template literal types by full Unicode codepoints rather than UTF-16 code units, so characters like emoji that span surrogate pairs are no longer split and mismatched during type narrowing.
noUncheckedSideEffectImports
A TS7 compiler option, enabled by default, that requires side-effect-only imports (e.g., `import './styles.css'`) to resolve to a module declaration, catching missing type declarations at compile time rather than runtime.
Import assertions with `with`
The ECMAScript standard replacement for the deprecated `assert` keyword in import statements. `import data from './config.json' with { type: 'json' }` is the TS7-compatible syntax.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗