DEV Community

Abanoub Hanna
Abanoub Hanna

Posted on β€’ Originally published at abanoubhanna.com

2

Why Microsoft is porting Typescript Compiler into Go ?

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.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

πŸ‘‹ Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay