跪拜 Guibai
← All articles
Frontend

TypeScript 7.0 Ships a Go Compiler That Cuts Build Times by 90%

By Kyrie678 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

A TypeScript build that took two minutes now takes fifteen seconds; editor feedback that required a coffee break now appears before you lift your fingers from the keyboard. The Go rewrite removes the single-threaded bottleneck that made large TypeScript codebases painful, and the new defaults force a clean break from legacy module formats that have no place in modern bundler-based workflows.

Summary

TypeScript 7.0 ports the entire compiler to Go, producing a single native binary that compiles VS Code in 10.6 seconds instead of 125.7 seconds—an 11.9x speedup—while using 18% less memory. The language server is now multi-threaded, cutting the time to first error from 17.5 seconds to under 1.3 seconds in large projects. A new `--checkers` flag controls parallel type-checking workers, and the `--watch` mode was rewritten with a Go-native file watcher ported from Parcel's C++ implementation.

The release also hardens defaults that TypeScript 6 previewed: `strict` is on, `module` defaults to `esnext`, `target` points to the latest ECMAScript version, and `@types` packages are no longer auto-loaded. Several legacy targets and module formats—ES5, AMD, UMD, SystemJS, and the `node`/`classic` resolution strategies—are now hard errors. Template literal types finally operate on Unicode codepoints instead of UTF-16 code units, fixing long-standing emoji-splitting bugs.

Because 7.0 ships without a programmatic API, tools that embed TypeScript (Vue, Svelte, Astro, MDX) must stay on TS 6 for now. A compatibility package, `@typescript/typescript6`, lets projects run both versions side-by-side. Early adopters report dramatic gains: Slack cut CI type-checking from 7.5 minutes to 1.25 minutes, Canva's first-error time dropped from 58 seconds to 4.8 seconds, and Microsoft News Services saves 400 CI-hours per month.

Takeaways
Full-build compilation is 8–12x faster than TypeScript 6 on real projects; VS Code compiles in 10.6 seconds instead of 125.7 seconds.
Memory usage drops alongside the speedup—VS Code's peak fell from 5.2 GB to 4.2 GB, an 18% reduction.
The `--checkers` flag controls parallel type-checking workers (default 4); 8 workers push VS Code to a 16.7x speedup over TS 6.
`strict: true` is now the default; `module` defaults to `esnext`; `target` defaults to the latest ECMAScript version.
`@types` packages are no longer auto-loaded—projects must explicitly list them in `compilerOptions.types`.
`target: es5` and `module: amd / umd / systemjs` are hard errors; `moduleResolution: node / classic` is removed.
Template literal types now split on Unicode codepoints, fixing emoji and non-BMP character handling.
JSDoc support was refactored: `@enum` is no longer recognized, Closure-style function syntax is dropped, and `@class` no longer implicitly marks constructors.
TypeScript 7.0 ships without a programmatic API; Vue, Svelte, Astro, and MDX projects must remain on TS 6 until 7.1.
The `@typescript/typescript6` compatibility package lets projects run TS 7 for compilation and TS 6 for tooling APIs side-by-side.
Slack cut CI type-checking from 7.5 minutes to 1.25 minutes; Canva's first-error time dropped from 58 seconds to 4.8 seconds.
Microsoft News Services saves 400 CI-hours per month; the PowerBI team called the upgrade 'life-saving' even before rename support landed.
Conclusions

The Go port is not a partial rewrite of hot paths—it is a faithful line-by-line transplant of the entire compiler, which means the speedup comes from the runtime (no JIT, shared-memory threading) rather than algorithmic changes. That makes the 8–12x figure a pure measure of what JavaScript's single-threaded model was costing.

Shipping without a programmatic API is a deliberate sequencing choice that forces the ecosystem to decouple 'using TypeScript as a compiler' from 'embedding TypeScript as a library.' The compatibility-package pattern—running two versions side-by-side via npm aliases—is likely to become a standard migration tactic for major toolchain overhauls.

The removal of ES5, AMD, UMD, and SystemJS as hard errors, combined with `strict` and `esnext` module defaults, amounts to the strongest opinion TypeScript has ever expressed about target environments. Projects that cannot adopt these defaults are now explicitly unsupported, which will accelerate the retirement of legacy build pipelines across the ecosystem.

The Unicode codepoint fix for template literal types is a breaking change that most teams will welcome without noticing—until it silently breaks a utility type that relied on UTF-16 surrogate-pair splitting. The breakage surface is small but real for type-level string manipulation libraries.

Concepts & terms
Native port (Go rewrite)
Rewriting the TypeScript compiler—originally written in TypeScript/JavaScript and running on Node.js—in Go, which compiles to a single native binary with no JIT warm-up and supports shared-memory multi-threading via goroutines.
--checkers
A new TypeScript 7 CLI flag that sets the number of parallel type-checking worker threads. Defaults to 4; higher values exploit more CPU cores at the cost of some duplicate computation across workers.
Unicode codepoint vs. UTF-16 code unit
A codepoint is a single Unicode character (e.g., an emoji); UTF-16 encodes some codepoints as two 16-bit code units (surrogate pairs). TypeScript 6 template literal types split on code units, breaking emoji; TypeScript 7 splits on codepoints, matching JavaScript's `for...of` behavior.
npm alias for side-by-side versions
Using npm's package alias syntax (`"typescript": "npm:@typescript/typescript6@^6.0.2"`) to install two versions of TypeScript under different package names, letting a project compile with TS 7 while tooling consumes the TS 6 API.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗