TypeScript 7 Native Compiler: 10x Faster Builds with Go Rewrite
Microsoft just pulled off one of the most audacious moves in programming language history: rewriting the TypeScript compiler from TypeScript to Go.
The results are stunning:
- VS Code: 77.8s → 7.5s (10.4x faster)
- Playwright: 11.1s → 1.1s (10x faster)
- Project load time: 8x faster
This isn't an optimization. It's a complete rewrite from the ground up.
Here's why it matters, what breaks, and how to migrate.
Why Rewrite TypeScript in Go?
TypeScript's compiler (tsc) is written in TypeScript. It compiles itself.
This is called bootstrapping, and it's elegant. But it has a fundamental problem: it's slow.
The Performance Ceiling
JavaScript (and by extension, TypeScript) is interpreted. V8 JIT-compiles hot functions, but there's always overhead:
- Garbage collection pauses
- Dynamic type checks at runtime
- Prototype chain lookups
- No SIMD or low-level optimizations
For a compiler that processes millions of lines of code, this adds up.
Why Go?
1. Native Performance Go compiles to machine code. No JIT. No interpreter. Just CPU instructions.
2. Concurrency Go's goroutines make parallel compilation trivial:
// Type-check 100 files in parallel
for _, file := range files {
go func(f File) {
typeCheck(f)
}(file)
}TypeScript's JavaScript implementation struggles with parallelism (Web Workers are clunky).
3. Memory Management Go's garbage collector is designed for low-latency server workloads. It pauses for microseconds, not milliseconds.
4. Deployment A single Go binary. No Node.js runtime dependency. No node_modules.
Benchmarks: The Numbers Don't Lie
Microsoft tested TypeScript 7 (Go) against TypeScript 6 (JavaScript) on real-world codebases:
| Project | TS 6 (JS) | TS 7 (Go) | Speedup |
|---|---|---|---|
| VS Code | 77.8s | 7.5s | 10.4x |
| Playwright | 11.1s | 1.1s | 10.0x |
| Azure SDK | 142.3s | 14.1s | 10.1x |
| TypeScript itself | 23.4s | 2.8s | 8.4x |
Across the board: 8-10x faster.
Cold Start Performance
TypeScript 6:
time tsc --noEmit
# First run: 12.3s (loading Node, parsing tsconfig, etc.)TypeScript 7:
time tsc --noEmit
# First run: 1.2s (native binary, instant startup)Cold start is 10x faster too.
What Changed: TypeScript 6 → 7
TypeScript 7 isn't just faster—it's cleaner.
1. Strict-by-Default
TypeScript 7 enables all strict flags by default:
{
"compilerOptions": {
"strict": true, // Now the default
"strictNullChecks": true, // Included in strict
"strictFunctionTypes": true, // Included in strict
"noImplicitAny": true // Included in strict
}
}Before (TS 6):
function greet(name) { // OK (implicit 'any')
console.log("Hello " + name);
}Now (TS 7):
function greet(name) { // ERROR: Parameter 'name' implicitly has an 'any' type
console.log("Hello " + name);
}
// Fix:
function greet(name: string) { // OK
console.log("Hello " + name);
}Migration: Add explicit types or set "strict": false temporarily.
2. ES5 Target Dropped
TypeScript 7 no longer compiles to ES5.
Minimum target: ES2015 (ES6)
{
"compilerOptions": {
"target": "ES5" // ERROR: ES5 is no longer supported
}
}Why: ES5 polyfills bloated output. Modern browsers support ES2015 (released in 2015, 11 years ago).
Impact: If you need IE11 support, stick with TypeScript 6.
3. AMD, UMD, SystemJS Module Formats Removed
TypeScript 7 only supports:
ESNext(modern ES modules)CommonJS(Node.js)
{
"compilerOptions": {
"module": "AMD" // ERROR: AMD is no longer supported
}
}Migration:
- Browser code: Use
ESNext+ bundler (Vite, webpack, Rollup) - Node.js: Use
CommonJSorNodeNext
4. Classic Node Module Resolution Removed
TypeScript 7 removes the node resolution strategy.
{
"compilerOptions": {
"moduleResolution": "node" // ERROR: Use 'node16' or 'nodenext'
}
}Fix:
{
"compilerOptions": {
"moduleResolution": "node16" // Modern Node.js resolution
}
}This aligns with Node's ESM resolution algorithm.
The Migration Process
Step 1: Install TypeScript 7
npm install -D typescript@7.0.0
# Or globally
npm install -g typescript@7.0.0Step 2: Update tsconfig.json
{
"compilerOptions": {
"target": "ES2015", // Minimum
"module": "ESNext", // Or "CommonJS"
"moduleResolution": "node16",
"strict": true // Recommended (or add types gradually)
}
}Step 3: Fix Type Errors
Run the compiler:
tsc --noEmitCommon Errors:
1. Implicit Any:
// Error: Parameter 'x' implicitly has an 'any' type
function double(x) { return x * 2; }
// Fix:
function double(x: number) { return x * 2; }2. Null/Undefined Checks:
function getUser(id: string) {
return users.find(u => u.id === id); // Returns User | undefined
}
const user = getUser("123");
console.log(user.name); // ERROR: 'user' is possibly 'undefined'
// Fix:
if (user) {
console.log(user.name);
}3. Function Type Strictness:
type Handler = (event: Event) => void;
const handler: Handler = (event: MouseEvent) => { // ERROR
console.log(event.clientX);
};
// MouseEvent is more specific than Event
// TS 7 enforces contravariance for function parametersStep 4: Test Thoroughly
Strict mode catches real bugs:
// TS 6: Compiles fine
function processUser(user: User | null) {
console.log(user.name); // Runtime error if user is null
}
// TS 7: Compile error
function processUser(user: User | null) {
console.log(user.name); // ERROR: Object is possibly 'null'
}
// Fix:
function processUser(user: User | null) {
if (user) {
console.log(user.name);
}
}This would've crashed in production. TypeScript 7 catches it at compile time.
Performance in CI/CD
The biggest win is in CI pipelines.
Before (TypeScript 6):
- name: Type Check
run: npm run type-check
# Duration: 4m 32sAfter (TypeScript 7):
- name: Type Check
run: npm run type-check
# Duration: 28sFrom 4.5 minutes to 28 seconds.
For a team running 50 CI builds/day:
- Time saved: 200 minutes/day
- Developer happiness: Priceless
Watch Mode Improvements
tsc --watch is significantly better in TypeScript 7.
TypeScript 6:
tsc --watch
# Initial compile: 12s
# File change detected...
# Recompiling: 8sTypeScript 7:
tsc --watch
# Initial compile: 1.2s
# File change detected...
# Recompiling: 0.3sIncremental recompilation is 25x faster.
Breaking Changes: Full List
- Strict mode is default (add explicit types or disable)
- ES5 target removed (minimum ES2015)
- AMD/UMD/SystemJS module formats removed (use ESNext or CommonJS)
- Classic node module resolution removed (use node16 or nodenext)
- Deprecated APIs removed:
- ts.createProgram old signature - ts.createSourceFile with languageVersion < ES2015
Should You Upgrade?
Yes, if:
- Your CI builds are slow
- You work on large TypeScript codebases (500+ files)
- You're already using strict mode
- You don't support IE11
Wait, if:
- Your codebase has lots of implicit
any - You rely on AMD/UMD modules
- You need ES5 output
- Your team isn't ready for strict type checking
Gradual Migration Strategy
Don't upgrade all at once. Use this approach:
Phase 1: Test in Isolation
# Install TS 7 separately
npm install -D typescript-next@7.0.0
# Test without affecting production
npx typescript-next --noEmitPhase 2: Enable Strict Gradually
{
"compilerOptions": {
"strict": false,
"strictNullChecks": true // Start with one flag
}
}Fix errors. Then enable the next flag.
Phase 3: Update Dependencies
Check if your libraries support TypeScript 7:
npm ls typescriptIf packages bundle .d.ts files for TS 6, they might break.
Phase 4: Full Rollout
Once CI is green:
npm install -D typescript@7.0.0Update package.json:
{
"engines": {
"typescript": ">=7.0.0"
}
}The Bigger Picture
TypeScript 7 proves a controversial idea: sometimes you need to rewrite in a different language.
Precedents:
- Rust-based JS tools: SWC, Turbopack, Oxc (all 10-100x faster than JS equivalents)
- Go-based tools: esbuild (100x faster than webpack)
- Zig-based tools: Bun (3x faster than Node.js)
JavaScript is amazing for application code. But for tooling (compilers, bundlers, linters), native languages dominate.
Conclusion
TypeScript 7 is the most significant TypeScript release ever.
10x faster builds change how you work:
- CI pipelines that took minutes now take seconds
- Watch mode feels instant
- Large refactors don't freeze your editor
The breaking changes are real, but they enforce best practices. Strict mode catches bugs. Dropping ES5 reduces bloat.
If you're building TypeScript apps, TypeScript 7 is worth the migration effort.
The future of TypeScript is native. And it's fast.
---
Resources: