Recent news came out that Microsoft is working on a new TypeScript compiler written in Go (or golang - whatever you prfer). It promises to be 10x faster than the current compiler that is written - well in TypeScript itself. While this is certainly good news, why isn't Microsoft betting on .NET and C#?
TypeScript-Go
It is really good that the team decided to rewrite the compiler and toolchain around TypeScript as I was also frustrated when my IDE has to wait for a few moments to do its thing! The current roadmap is to release a useable version with TypeScript 7.0, whenever that is. I want to focus more on the question: Why Go?
Why Go?
The team itself gave a brief overview on the GitHub discussion forum:
Idiomatic Go strongly resembles the existing coding patterns of the TypeScript codebase, which makes this porting effort much more tractable. [...] Go's model therefore nets us a very big win in reducing codebase complexity, while paying very little actual runtime cost for garbage collection. [...] Go does an excellent job of making this ergonomic, especially in the context of needing to resemble the JavaScript version of the code.
They also discuss some weaknesses of Go around JS Interop. Given that Microsoft also works on C# and .NET, why not use that? Anders Hejlsberg, creator of TypeScript AND C#, answers that in an interview around the question was C# considered (and also why Rust didn't make the cut):
It was [...] but I will say that I think Go definitely is [...] the lowest level language and still have automatic garbage collection. It's the most native first language we can get to and still have automatic GC. C# it's byte code first and there is some ahead-of-time compiliation but it's not on all platforms and [...] doesn't have a decade of hardening [...] and was not engineered that way to begin with. Go has a little bit more expressiveness to data structure layout and structs. [...] Our JavaScript codebase is written in a highly functional style.
The main and most important part here is, Microsoft is a huge company that can effort to run multiple tech stacks simultaneously. While there might be a lot of overlap with C#, where the migration is first priority. It might have looked different if they would have rewritten it from scratch. Given that Anders Hejlsberg has a very good understanding of C#, TS and Go - it is the most rationale choice for them.
Of course there would have been a chance for C# here, especially the hardening part. While C# is older than Go, native AOT is not. While this is a chance for C# to grow, it might delay the migration or make it much more complicated.