|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: TypeScript 7.0 will be 10x faster with Go |
| 4 | +description: Microsoft is rewriting TypeScript's compiler in Go. Learn what this means and how it will impact your workflow. |
| 5 | +date: 2025-03-18 |
| 6 | +cover: /images/blog/typescript-7-faster-with-go/cover.png |
| 7 | +timeToRead: 5 |
| 8 | +author: ebenezer-don |
| 9 | +category: tutorial |
| 10 | +--- |
| 11 | + |
| 12 | +Over the past decade, TypeScript has earned the trust of developers building large-scale JavaScript applications. It offers the safety net of a type system, reliable tooling, and codebases that are *arguably* easier to maintain. Yet, if you ask developers working with large projects, they'll likely express one common frustration: the TypeScript compiler can feel painfully slow. |
| 13 | + |
| 14 | +To address this challenge, Microsoft recently confirmed a significant shift under the hood. They are rewriting TypeScript's compiler (tsc) in Go. Officially codenamed "Project Corsa," this transition aims to dramatically improve compilation performance. Early benchmarks and public demonstrations from Microsoft suggest compilation speeds could improve roughly tenfold. |
| 15 | + |
| 16 | +Let's break down what this transition means, what's officially confirmed, and how it'll affect you as a developer. |
| 17 | + |
| 18 | +# What does this mean for TypeScript? |
| 19 | + |
| 20 | +Here's what we know so far: |
| 21 | + |
| 22 | +- **Compiler rewrite:** The TypeScript compiler, currently written in TypeScript and running on Node.js, is being rewritten from scratch in Go. Microsoft announced this under the internal name "Project Corsa." |
| 23 | +- **Motivation:** The primary motivation is performance. TypeScript compilation times and type-checking responsiveness are known to degrade as projects scale. |
| 24 | +- **Language stability:** The rewrite will not affect TypeScript's syntax or language design. It will continue emitting standard JavaScript as before. Developers will still write TypeScript exactly as they currently do. |
| 25 | +- **Standalone binary:** The new Go-based compiler will run as a standalone binary, removing the Node.js runtime dependency currently required for compilation. |
| 26 | + |
| 27 | +Microsoft has not announced any changes to TypeScript's language features, syntax, or output because of this rewrite. The transition to Go is an engineering effort to improve performance and maintainability. |
| 28 | + |
| 29 | +# Why Go specifically? Not Rust or C++? |
| 30 | + |
| 31 | +One question naturally arises: why Go specifically? While Microsoft hasn't provided a comprehensive breakdown comparing Go to alternatives like Rust or C++, they've [publicly shared](https://github.com/microsoft/typescript-go/discussions/411) some key factors: |
| 32 | + |
| 33 | +**Structural similarity:** Go's programming style closely resembles the existing TypeScript codebase, making it much easier to port TypeScript's logic while keeping behavior and optimizations intact. This is critical since Microsoft plans to maintain both the JavaScript and Go-based compilers for some time. |
| 34 | + |
| 35 | +**Memory management tradeoffs:** Unlike Rust, which requires manual memory handling, Go provides fine-grained control over memory allocation without forcing constant memory management decisions throughout the codebase. TypeScript's compiler doesn't suffer from latency-sensitive GC pauses, so Go's garbage collection works well for this use case. |
| 36 | + |
| 37 | +**Graph processing & AST traversal:** Go provides an ergonomic way to traverse complex trees and graphs, a key part of TypeScript's type-checking and compilation process. |
| 38 | + |
| 39 | +**Long-term API design considerations:** The TypeScript team wants more control over internal compiler APIs. While Go's interop with JavaScript isn't as strong as some alternatives, moving to a more intentional API design will help modernize the ecosystem. |
| 40 | + |
| 41 | +# Benchmark numbers: early results, still preliminary |
| 42 | + |
| 43 | +Perhaps the most attention-grabbing details involve benchmark numbers shared by Microsoft and industry publications. For instance, compiling the Visual Studio Code codebase (about 1.5 million lines of TypeScript) reportedly went from around 78 seconds with the current compiler down to roughly 7.5 seconds with the new Go-based compiler; a 10x improvement. Other large projects, such as Playwright and TypeORM, reportedly saw similar performance improvements (approximately 10x-13x faster). |
| 44 | + |
| 45 | +These numbers come directly from early demonstrations and internal testing shared by Microsoft. But benchmarks at this early stage often represent idealized or carefully selected scenarios. Real-world improvements for diverse TypeScript projects may vary, and final figures might differ as the implementation matures. |
| 46 | + |
| 47 | +# How will this affect tooling and ecosystem compatibility? |
| 48 | + |
| 49 | +A main concern among developers centers around compatibility with existing tools and integrations. Currently, TypeScript integrates smoothly with bundlers like Webpack, Vite, and esbuild, plus countless IDE plugins and language-server implementations. |
| 50 | + |
| 51 | +Microsoft has publicly committed to maintaining compatibility and minimizing disruption throughout the compiler transition. Still, it's realistic to expect that tooling relying heavily on internal compiler APIs or deeply integrated TypeScript behaviors may require some adjustments. It's been [confirmed](https://github.com/microsoft/typescript-go/discussions/411) that the TypeScript team will initially support both the existing JavaScript-based compiler and the new Go-based compiler concurrently. This dual-compiler support would allow tool authors and ecosystem maintainers ample time to adapt without immediate disruption. |
| 52 | + |
| 53 | +While Microsoft is prioritizing a smooth transition, developers and tool authors should prepare for minor integration adjustments, especially if their workflows rely directly on internal TypeScript compiler APIs. |
| 54 | + |
| 55 | +# Timeline and versioning: what we know |
| 56 | + |
| 57 | +Microsoft has confirmed that **TypeScript 7.0 will ship with the Go-based compiler** once it reaches feature parity with the current JavaScript-based version. Meanwhile, the existing compiler will continue under the **TypeScript 6.x** series, which will receive updates and breaking changes to align with the upcoming transition. |
| 58 | + |
| 59 | +Since some projects may depend on specific APIs or legacy configurations, **Microsoft will maintain TypeScript 6.x alongside TypeScript 7+** until the Go-based compiler reaches full stability and adoption. |
| 60 | + |
| 61 | +The rough timeline is: |
| 62 | + |
| 63 | +- **Mid-2025** – Preview release with basic type-checking. |
| 64 | +- **Late 2025** – Feature-complete version for project builds and language services. |
| 65 | + |
| 66 | +For now, both compilers will coexist, allowing developers to upgrade at their own pace. |
| 67 | + |
| 68 | +# What does this mean for you? |
| 69 | + |
| 70 | +This transition changes how TypeScript is compiled but not how developers use it. The language itself remains the same, and the compiler will continue outputting JavaScript as before. The main difference is that builds should be significantly faster, with better performance in large projects. |
| 71 | + |
| 72 | +That said, the new compiler is still in development, and benchmarks are early-stage. While Microsoft is working to maintain compatibility, some tools may need updates, and TypeScript 6.x will remain available for projects that aren't ready to switch immediately. |
| 73 | + |
| 74 | +The long-term goal is for the Go-based compiler to fully replace the current one, but until it reaches full stability, both will be maintained in parallel. |
| 75 | + |
| 76 | +We'll continue monitoring official announcements and detailed benchmarks as Microsoft progresses through this transition. Until then, you can remain cautiously optimistic: the future of TypeScript looks promising, and notably faster. |
0 commit comments