XplormityXplormity
HomeHandbooks
Browse
Xplormity

TLDR developer handbooks for
seasoned developers.

Handbooks

RustNestJSNext.jsGitDockerTypeScriptReactNode.jsDSASQLSystem DesignTailwind CSS

Site

HomeHandbooksAboutPrivacyTerms

Connect

GitHubTwitterLinkedIn

© 2026 Xplormity. All rights reserved.

HandbooksTypeScriptTypeScript 7.0 — The Go Rewrite

TypeScript 7.0 — The Go Rewrite

ts7performancego-rewritehandbook

TL;DR

  • TypeScript 7.0 rewrites the compiler in Go — 10x faster type-checking.
  • Same semantics as TS 6.0. Your code works identically, just faster.
  • Parallelized parsing, type-checking, and emitting.
  • New defaults: strict: true, module: esnext, no more node module resolution.
  • Install via @typescript/native-preview (beta) — will become typescript at GA.

Step 1: What Changed & Why

The decision to rewrite the TypeScript compiler in Go was one of the most significant moves in the JavaScript ecosystem's history. The team chose Go (not Rust, not C++) because Go's garbage collector matches JavaScript's memory model, making the port nearly 1:1 while gaining native compilation speed. This isn't just a performance improvement — it fundamentally changes what's possible: IDE responsiveness at enterprise scale, sub-second type checking on million-line codebases, and compilation fast enough to run on every keystroke.

The Problem

The TypeScript compiler was written in TypeScript (bootstrapped, compiled to JavaScript). For large codebases (1M+ lines), type-checking took minutes. CI pipelines were bottlenecked by tsc.

The Solution

Microsoft ported the entire compiler to Go (codenamed "Project Corsa"):

Metric TS 6.0 (JS) TS 7.0 (Go) Improvement
Type-checking (large project) 60s 6s 10x faster
Project load 8s 1s 8x faster
IntelliSense response 200ms 20ms 10x faster
Memory usage ~2GB ~400MB 5x less

Why Go (not Rust)?

  • Architectural alignment: Go's garbage collector and concurrency model mapped cleanly to the existing JS codebase
  • Port, not rewrite: The team wanted identical semantics, not a new implementation
  • Goroutines: Natural fit for parallelizing type-checking across files

Step 2: How to Use TypeScript 7.0

Getting started with TypeScript 7.0 is designed to be frictionless — the team kept the same tsc interface and tsconfig format so existing workflows don't break. The native binary is a drop-in replacement that requires no code changes. You install it alongside your existing setup, run the same commands, and watch build times collapse. This step matters because many teams hesitate to adopt major versions; the TS team specifically engineered the upgrade path to be zero-friction.

Installation

# Install the native preview (beta)
npm install -D @typescript/native-preview@beta

# Run the new compiler
npx tsgo --version
# Version 7.0.0-beta

# Type-check your project (same as tsc)
npx tsgo --noEmit

Running Side-by-Side with TS 6.0

You can use both during migration:

{
  "devDependencies": {
    "@typescript/native-preview": "^7.0.0-beta",
    "typescript": "npm:@typescript/typescript6@^6.0.0"
  }
}
  • npx tsgo → TypeScript 7.0
  • npx tsc6 → TypeScript 6.0

VS Code Extension

Install "TypeScript Native Preview" extension for the editor experience. It uses the same Go-based language server — instant IntelliSense.


Step 3: Parallelization

Parallelization is the second major win of the Go rewrite (after raw compilation speed). The JavaScript-based compiler was fundamentally single-threaded due to V8's execution model. Go's goroutines and channels let the new compiler check multiple files simultaneously, utilize all CPU cores during builds, and run type-checking in parallel with parsing. For large monorepos that previously took 30+ seconds to type-check, this means near-instant feedback even without project references.

TypeScript 7.0 parallelizes at multiple levels:

Checker Parallelization (--checkers)

# Default: 4 parallel type-checker workers
npx tsgo --noEmit

# Increase for large codebases on beefy machines
npx tsgo --noEmit --checkers 8

# Decrease for CI runners with fewer cores
npx tsgo --noEmit --checkers 2

Each checker worker gets a slice of files. They may duplicate some shared type work, but the overall speedup far outweighs it.

Builder Parallelization (--builders)

For monorepos with project references:

# Build multiple projects in parallel
npx tsgo --build --builders 4

⚠️ --checkers × --builders is multiplicative. --checkers 4 --builders 4 = up to 16 threads. Balance with your machine's cores.

Single-Threaded Mode

For debugging or comparing with TS 6.0:

npx tsgo --noEmit --singleThreaded

Step 4: Breaking Changes from 5.x

Every major version ships breaking changes, but TypeScript 7.0's are more significant because it also adopts TS 6.0's stricter defaults. The team bundled these together so you only migrate once instead of twice. Most breaking changes are about enabling stricter checks by default (things that were opt-in flags become the new baseline). Understanding these upfront prevents the "upgrade and 500 errors appear" experience that makes teams avoid upgrades.

TypeScript 7.0 adopts TS 6.0's defaults. If you're jumping from TS 5.x, these are the key changes:

New Defaults

// tsconfig.json — what's now DEFAULT (no need to set)
{
  "compilerOptions": {
    "strict": true,                    // Was false
    "module": "esnext",                // Was "commonjs"
    "target": "es2024",                // Was "es5"
    "noUncheckedSideEffectImports": true,
    "esModuleInterop": true            // Can't be set to false anymore
  }
}

Removed/Deprecated

What's Gone Replacement
target: "es5" Use "es2020" or later
moduleResolution: "node" Use "nodenext" or "bundler"
module: "amd", "umd", "systemjs" Use "esnext" or "preserve"
baseUrl for path mapping Use relative paths from project root
downlevelIteration Not needed — target ES2015+

Must Set Explicitly

{
  "compilerOptions": {
    // rootDir must be set if tsconfig.json is outside src/
    "rootDir": "./src",

    // types must list what you need (no longer auto-includes all @types/*)
    "types": ["node", "jest"]
  },
  "include": ["./src"]
}

Step 5: Migration Guide

Migrating to TypeScript 7.0 requires different approaches depending on your starting point. Teams on TS 6.x have a smooth path since 7.0 is mostly a speed upgrade with the same semantics. Teams jumping from TS 5.x face both the behavioral changes (6.0 defaults) and the tooling switch. This guide gives you a concrete checklist for each scenario, including the tsconfig changes, build tool updates, and CI adjustments that make the migration predictable.

From TS 5.x (the bigger jump)

  1. Update tsconfig.json:

    {
      "compilerOptions": {
        "strict": true,
        "module": "esnext",
        "moduleResolution": "bundler",  // or "nodenext"
        "target": "es2022",
        "rootDir": "./src",
        "types": ["node"]
      }
    }
    
  2. Fix import ... = require() syntax — use ESM imports instead.

  3. Fix namespace usage — module keyword in namespaces is removed.

  4. Fix import assertions — change assert to with:

    // Before
    import data from "./data.json" assert { type: "json" };
    // After
    import data from "./data.json" with { type: "json" };
    

From TS 6.0 (smooth upgrade)

If you already compile cleanly with TS 6.0 + stableTypeOrdering: true, TS 7.0 should work identically. Just swap the package:

npm install -D @typescript/native-preview@beta
npx tsgo --noEmit  # should produce identical output

Step 6: Impact on Your Workflow

The speed improvements from the Go rewrite have second-order effects on how you work. CI pipelines that spent 2 minutes on type-checking now finish in seconds, making it feasible to run full type-checks on every PR without slowing down developers. IDE responsiveness transforms the editing experience — instant red squiggles instead of multi-second delays on large files. And monorepos that required complex project references for performance can now type-check everything from root in acceptable time.

CI/CD

# GitHub Actions — much faster CI
- name: Type Check
  run: npx tsgo --noEmit --checkers 2
  # Was 3 minutes with tsc, now 20 seconds

Monorepos

# Build all projects in parallel
npx tsgo --build --builders 4 --checkers 4
# Respects dependency graph — won't build B before A if B depends on A

Editor

The TypeScript Native Preview VS Code extension provides:

  • Instant IntelliSense (no more lag on large files)
  • Auto-imports
  • Inlay hints
  • Go-to-definition / Find all references
  • JSX linked editing

Key Takeaways for Interviews

  1. "Why was TypeScript rewritten in Go?"

    • Performance. JS-based compiler was too slow for million-line codebases. Go enables native speed + shared memory parallelism.
  2. "Does TS 7.0 change the language?"

    • No. Same type system, same semantics. It's a compiler performance upgrade, not a language change.
  3. "What's the migration path?"

    • From TS 6.0: drop-in replacement. From TS 5.x: need to update deprecated options first.
  4. "Why not Rust?"

    • Go was chosen for architectural alignment with the existing codebase (GC, goroutines map to the original JS design patterns), enabling a faithful port rather than a risky rewrite.
Utility Types Deep DiveType Narrowing & Discriminated Unions

On this page

  • TL;DR
  • Step 1: What Changed & Why
  • The Problem
  • The Solution
  • Why Go (not Rust)?
  • Step 2: How to Use TypeScript 7.0
  • Installation
  • Running Side-by-Side with TS 6.0
  • VS Code Extension
  • Step 3: Parallelization
  • Checker Parallelization (--checkers)
  • Builder Parallelization (--builders)
  • Single-Threaded Mode
  • Step 4: Breaking Changes from 5.x
  • New Defaults
  • Removed/Deprecated
  • Must Set Explicitly
  • Step 5: Migration Guide
  • From TS 5.x (the bigger jump)
  • From TS 6.0 (smooth upgrade)
  • Step 6: Impact on Your Workflow
  • CI/CD
  • Monorepos
  • Editor
  • Key Takeaways for Interviews