On March 11, 2025 Anders Hejlsberg, technical fellow at Microsoft, announced porting Typescript Compiler in Go programming language on the official YouTube channel of Microsoft Developers.
Why moving to another language? Why not self-hosting?
Self-hosting is writing the language compiler it the language itself. The TSC is self-hosted right now, but the team is porting it into Go.
The Typescript team saw an increase of latency with the grow of the codebases in Microsoft, so, they think tsc needs to get faster and scalable. So, it needs to be more concurrent for better scalability, and more native to get as much performance from the hardware as possible.
They thought of Go, Rust, C#, .. and other languages.
Why Go ?
Anders said Go is similar to Typescript in syntax so tsc can be ported (rewritten in exact same way) not rewritten from scratch reasoning from first principles in a new language.
Typescript team members can pick Go language in a week or so, because Go is an easy to learn programming language.
Why not C# ?
Typescript Compiler codebase relies heavily on functions and structs not OOP, so it is easier to port the codebase into Go than porting it into C# as C sharp is more object oriented.
Why not Rust ?
Rust language is too different than Typescript, so it needs a complete rewrite reasoning from first principles using "the Rust way". It is a multi-year job with too much complexity.
Developers and engineers working on the Typescript compiler team need months to learn Rust.
the codebase is written on a way that is relying on a garbage collector. So, if we rewrite it in Rust, its code layout will be so different. It will be a harder to get done in a timely manner.
Gains of porting tsc into Go
- 10X more speed
- half memory usage
- more scalable as a benefit of Go concurrency
My opinion on porting tsc into Go
I see it as a mature decision that weighs the benefits and moves forward into a better performant efficient yet easily maintainable future.
The faster compile time of Go language is beneficial as it helps developers focus on iterating in their code not waiting for compiling or testing. It is similar to dynamic typed language in its compile time, yet it is static typed and native. It is the best of both worlds.
Cross platform compatibility of Go language made it a better choice for tsc as it needs to be available on Linux operating systems, Windows (of course), and MacOS.
As Anders put it on his interview on Michigan Typescript channel: "Go is the lowest level language we can get to and still have automatic garbage collector, it's the most native-first language we can get to and still have automatic GC". (at 19:29 time mark).
I hope you enjoyed reading this post as much as I enjoyed writing it. If you know a person who can benefit from this information, send them a link of this post. If you want to get notified about new posts, follow me on YouTube, Twitter (x), LinkedIn, and GitHub.
Top comments (0)