Microsoft Shocks Developers by Rewriting TypeScript in Go

Microsoft Shocks Developers by Rewriting TypeScript in Go

In a surprising move, Microsoft announced yesterday that it is completely rewriting the TypeScript programming language. TypeScript, a beloved tool in modern web development, is one of the most important projects in the tech world. However, it has a significant flaw: the TypeScript compiler is written in TypeScript itself, which limits its ability to handle low-level optimizations. To address this, Microsoft has decided to rewrite the compiler in an unexpected language—Go, developed by Google, Microsoft's longtime rival.


Why the Change?

TypeScript is a superset of JavaScript and doesn’t have its own runtime. Instead, TypeScript code is compiled (or "transpiled") into JavaScript, which then runs in environments like Node.js, Deno, or web browsers. The problem is that writing the TypeScript compiler in TypeScript makes it difficult to implement low-level optimizations, such as direct memory access or native multi-threading. These limitations have led to performance issues, especially in large projects.

By rewriting the compiler in Go, Microsoft has already achieved significant performance improvements. For example, the compile time for Visual Studio Code dropped from 70 seconds to just 7 seconds—a 10x speedup. Similar improvements have been seen in other projects. This means developers can expect faster performance in their editors, especially when working on large codebases.

Why Go?

Go, a language developed by Google, is known for its simplicity and efficiency. Unlike JavaScript, Go is a compiled language, meaning it can be turned into optimized machine code for various processors. This is different from languages like Java or C#, which compile into bytecode and run on virtual machines. Go also uses automatic memory management through garbage collection, making it easier to work with compared to languages like C++ or Rust.

Microsoft’s decision to use Go is also about portability. The rewrite isn’t just about changing the language; it’s about porting the existing TypeScript codebase to Go. This means the behavior and semantics of TypeScript will remain the same—your favorite (or least favorite) compiler errors will still happen, just much faster.

What’s Next?

The new Go-based compiler won’t be available immediately. The current version is TypeScript 5.8, and the new compiler is expected to launch with TypeScript 7. This transition could take months or even years. However, the long-term benefits are clear: faster compile times, better performance, and a more efficient development experience.

A Bold Move by Microsoft

Microsoft deserves credit for this decision. Instead of sticking with one of their in-house languages or jumping on the Rust or Zig hype trains, they chose the best tool for the job—even if it meant using a language developed by their competitor, Google. This move shows a willingness to prioritize performance and efficiency over corporate pride.


Aleksandr Kondaurov

Fullstack software engineer | AWS, NodeJS, React | TypeScript, Scala, Java

5 天前

It's not a rewrite but porting. And what do you mean by "completely rewriting the TypeScript programming language"? It doesn't make any sense to rewrite one language to another. Microsoft want to port their compiler but don't change TypeScript itself, this is hilarious

要查看或添加评论,请登录

Homayoun Mohammadi的更多文章

社区洞察