Site icon ni18 Blog

Why Microsoft Rewrote TypeScript in Go

Why Microsoft Rewrote TypeScript in Go: Speed, Benefits, and More Explained

Why Microsoft Rewrote TypeScript in Go: Speed, Benefits, and More Explained

TypeScript is a superstar in the coding world, loved by developers for adding safety and smarts to JavaScript. But as projects get bigger, it’s been showing its age—slow builds, laggy editors, and heavy memory use have frustrated users. Enter Microsoft’s bold move: rewriting the TypeScript compiler in Go, a fast, native programming language. Announced on March 11, 2025, this overhaul—dubbed Project Corsa—promises to make TypeScript 10 times faster.

So, why did Microsoft pick Go for this job? And what goodies does it bring to developers like you? In this blog, we’ll unpack the reasons behind the switch and explore the jaw-dropping benefits in plain English. Whether you’re a TypeScript newbie or a pro, you’ll see why this change is a big deal in 2025. Let’s dive in!


Why Rewrite TypeScript? The Problem with JavaScript

Before we get to Go, let’s talk about why TypeScript needed a makeover. Originally, TypeScript was written in JavaScript and ran on Node.js. That made sense back in 2012—it’s a JavaScript tool, after all! But as codebases grew to millions of lines (think VS Code or Playwright), cracks started showing:

Why? JavaScript’s runtime (Node.js) is built for browser tasks like rendering web pages, not the heavy lifting of a compiler. Compilers crunch tons of code fast, and Node.js just wasn’t cutting it. Microsoft saw the pain—developers deserve better—so they decided to port TypeScript to native code. But why Go? Let’s find out.


Why Go? Microsoft’s Smart Choice

Microsoft could’ve picked Rust, C#, or another language, but they chose Go (aka Golang) for Project Corsa. Here’s why, straight from the team (and a nod to Anders Hejlsberg’s video explanation at 2:30):

1. Native Speed Made Simple

Go compiles to native code—super-fast machine instructions your computer loves. Unlike JavaScript, which needs a runtime to translate it, Go skips the middleman. Plus, it’s low-level enough to control how data moves but high-level enough to avoid Rust’s tricky memory management.

2. Concurrency Built-In

Compilers juggle lots of tasks—parsing files, checking types, spitting out code. Go’s concurrency (handling multiple jobs at once) is a breeze with its “goroutines.” Microsoft used this to turbocharge Corsa, splitting work across your computer’s cores.

3. Matches TypeScript’s Style

Go’s structural typing (how objects are shaped) mirrors TypeScript’s, making the port smoother. It’s like moving furniture to a house with the same layout—less hassle than a total redesign.

4. Single-File Output

Go builds one tidy executable file. No messy dependencies or setup—just grab tsc and go. Compare that to Node.js, where you need a whole runtime installed.

5. Garbage Collection

Unlike Rust, Go has automatic memory management (garbage collection). That means Microsoft could focus on speed, not wrestling with memory leaks. It’s a productivity win for a big project like this.

6. Cross-Platform Power

Go works flawlessly on Windows, macOS, and Linux, with no tweaks needed. Since TypeScript devs use all kinds of machines, Go’s a perfect fit.

In short, Go gives Microsoft speed, simplicity, and flexibility—without reinventing the wheel. As Hejlsberg said, “It’s a line-by-line port, not a rewrite,” keeping the soul of TypeScript intact.


The Benefits of TypeScript in Go

So, what’s in it for you? Rewriting TypeScript in Go (aka TypeScript 7.0) brings a treasure chest of perks. Let’s break them down with examples and numbers from Microsoft’s tests.

1. Blazing-Fast Performance

The native Go version slashes build times by 10x or more. Here’s proof from real projects:

CodebaseSize (Lines)Old Time (JS)New Time (Go)Speedup
VS Code1,505,00077.8s7.5s10.4x
Playwright356,00011.1s1.1s10.1x
TypeORM270,00017.5s1.3s13.5x
date-fns104,0006.5s0.7s9.5x

2. Turbocharged Editors

Your editor (like VS Code) is where you live as a developer. Corsa makes it snappy:

Why? Native code skips JavaScript’s overhead, and Go’s efficiency keeps things smooth.

3. Lighter on Memory

The Go version uses half the memory of the old JavaScript one. For example:

Less memory means your computer stays happy, even with giant codebases.

4. Better Developer Experience

Speed isn’t just about numbers—it’s about feeling good while coding:

Corsa’s speed makes these everyday tasks a joy, not a chore.

5. Powering AI Tools

AI coding assistants (like GitHub Copilot) thrive on fast, full-project analysis. Corsa’s low latency unlocks:

In 2025, this could redefine how we code with AI.

6. Language Server Protocol (LSP)

Corsa adopts LSP, a standard that connects editors to language tools. Benefits:


How Go Makes It Happen

Let’s peek under the hood at how Go delivers these wins:

It’s like upgrading from a single-lane road to a multi-lane highway—everything flows faster.


Why Not Rust or C#?

You might wonder: why not Rust (super fast) or C# (Microsoft’s own)? Here’s the scoop:

On X, devs debate this—“Rust would’ve been epic!”—but Microsoft’s choice prioritizes practicality. Go’s balance of speed and ease sealed the deal.


What’s Next for Corsa in 2025

This isn’t a “done” project—it’s rolling out:

Try it now on GitHub (microsoft/typescript-go)—it’s a work in progress, but the speed’s already real.


Final Thoughts

Microsoft rewrote TypeScript in Go to fix its biggest pain: performance. By ditching JavaScript’s runtime for Go’s native power, they’ve slashed build times by 10x, halved memory use, and supercharged your editor—all while setting the stage for AI-driven coding. It’s a win for developers in 2025, whether you’re on a tiny app or a massive codebase.

Lets Do the Discussion on Reddit : https://www.reddit.com/user/ni18_in/comments/1j8yull/typescript_project_corsa_10x_faster_builds_are/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

Exit mobile version