Get AI summaries of any video or article — Sign up free
Microsoft goes nuclear on TypeScript codebase… thumbnail

Microsoft goes nuclear on TypeScript codebase…

Fireship·
4 min read

Based on Fireship's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Microsoft is rewriting the TypeScript compiler in Go to overcome performance limits caused by the compiler being written in TypeScript.

Briefing

Microsoft is accelerating the TypeScript compiler by rewriting it in Go, aiming to eliminate a core performance bottleneck: TypeScript’s compiler is written in TypeScript, which limits low-level optimization. The practical result is a major speedup—Microsoft reports cutting VS Code TypeScript compile time from 70 seconds to 7 seconds, with similar ~10x improvements across other projects. For developers, that translates into faster feedback loops in large codebases and less editor lag when working with big TypeScript projects.

The change is also framed as a “port,” not a brand-new implementation from scratch. Microsoft plans to convert the existing TypeScript codebase line-by-line into equivalent Go code, preserving the compiler’s behavior and semantics. That means the same kinds of compiler errors and edge-case behavior should remain—just delivered much faster. The rewrite targets the long-term goal of making TypeScript’s tooling more responsive without changing what developers already rely on.

Why Go? The key technical reasons are performance portability and compilation model. Unlike Java or C-style toolchains that typically compile to bytecode running on a virtual machine, Go compiles directly to optimized machine code for different chip architectures. Go also includes automatic memory management via garbage collection, which can reduce the complexity of manual memory handling compared with C++ or Rust. Microsoft’s choice of Go—rather than sticking with an in-house language or jumping onto Rust or Zig—signals a focus on engineering constraints: the compiler needs to run fast across platforms, and the implementation language must support that efficiently.

The timeline matters. The rewrite is not expected to ship immediately because TypeScript is currently at version 5.8, while Microsoft isn’t planning a release until TypeScript 7. Even then, adoption could take months or longer as the ecosystem transitions.

For developers, the immediate takeaway is that TypeScript performance issues tied to compiler speed should improve substantially, especially in editors like VS Code and in large repositories. The longer-term takeaway is that Microsoft is willing to break with language loyalty—using a language associated with Google rather than a Microsoft-first option—to fix a foundational tooling problem. When the new compiler lands, the same TypeScript experience should feel dramatically snappier, with faster builds and fewer productivity hits from slow typechecking.

Cornell Notes

Microsoft is rewriting the TypeScript compiler in Go to remove a fundamental limitation: the compiler is currently written in TypeScript, which makes low-level optimization harder. Microsoft reports about a 10x speedup, including a VS Code compile-time drop from 70 seconds to 7 seconds. The effort is effectively a port—converting the existing TypeScript compiler code line-by-line into equivalent Go—so compiler behavior and error semantics should remain consistent, just faster. The rollout is expected around TypeScript 7, not immediately from TypeScript 5.8, so ecosystem migration will take time. The choice of Go centers on compiled performance and portability, since Go builds optimized machine code across architectures and uses garbage collection to simplify memory management.

What problem inside TypeScript’s toolchain is driving the rewrite?

The TypeScript compiler is written in TypeScript. Because TypeScript itself is a higher-level language that compiles/transpiles to JavaScript, the compiler implementation lacks the low-level optimization capabilities needed for maximum performance (for example, direct memory access and efficient native multi-threading). Re-implementing the compiler in a language better suited for low-level performance is the core fix.

What does “rewrite” mean here, and what should developers expect to stay the same?

It’s not a clean-slate rewrite so much as a port. Microsoft plans to convert every line of the existing TypeScript compiler code into equivalent Go code, preserving the original compiler’s behavior and semantics. That implies developers should still see the same kinds of compiler errors and edge-case behavior—only delivered much faster.

How big are the performance gains, and where do they show up first?

Microsoft reports roughly 10x speedups. A concrete example is VS Code TypeScript compile time dropping from 70 seconds to 7 seconds. The same magnitude of improvement is claimed across multiple related projects, and the editor experience should benefit immediately once the new compiler is integrated.

Why Go specifically—what advantages does it bring compared with other options?

Go is compiled into optimized machine code for different chip architectures, improving portability and performance. Java/C-style pipelines often compile to bytecode that runs on a virtual machine, while Go targets machine code more directly. Go also uses garbage collection, which can make memory management easier than manual approaches like C++ or Rust, reducing implementation complexity while still enabling strong performance.

When will this change reach users, and why isn’t it immediate?

TypeScript is at version 5.8, but Microsoft isn’t planning to release the new compiler until TypeScript 7. That gap suggests a long integration and migration period, potentially lasting months or longer as the ecosystem updates and the new compiler becomes the default.

Review Questions

  1. What specific limitation comes from having the TypeScript compiler written in TypeScript, and how does moving to Go address it?
  2. How does converting the compiler code line-by-line affect the likelihood of breaking changes for developers?
  3. What combination of compilation model and memory management features makes Go a good fit for a cross-platform compiler rewrite?

Key Points

  1. 1

    Microsoft is rewriting the TypeScript compiler in Go to overcome performance limits caused by the compiler being written in TypeScript.

  2. 2

    Reported speedups are around 10x, including a VS Code compile-time reduction from 70 seconds to 7 seconds.

  3. 3

    The effort is effectively a port: TypeScript compiler logic is converted line-by-line into Go to preserve semantics and error behavior.

  4. 4

    Go was chosen for compiled performance and portability, producing optimized machine code across architectures.

  5. 5

    Go’s garbage collection is expected to simplify memory management compared with languages like C++ or Rust.

  6. 6

    The new compiler is planned for TypeScript 7, not immediately from the current 5.8 baseline, so adoption will take time.

Highlights

VS Code TypeScript compile time is reported to fall from 70 seconds to 7 seconds after the Go-based compiler work.
The change is a port that preserves TypeScript compiler behavior, aiming to keep the same semantics and error patterns—just faster.
Go’s direct compilation to optimized machine code and garbage collection are central to the rationale for portability and performance.
Microsoft is targeting TypeScript 7 for release, implying a multi-version runway for rollout and ecosystem updates.

Topics