TypeScript & Golang

Microsoft just supercharged TypeScript compilation with Golang steroids!

You’ve likely heard a lot of buzz around TypeScript lately—so let’s dive into what makes it exciting.


Microsoft recently introduced a native port of the TypeScript compiler (tsgo), built with Golang. The TypeScript compiler (tsc) is itself written in TypeScript, and while this “dogfooding” approach has worked well for small to medium projects, it has always struggled with performance at scale. Its reliance on a single-threaded event loop limits compilation speed, making large projects sluggish.

With tsgo, Microsoft aims to remove these bottlenecks by porting the compiler and tools in a compiled language. The results? Up to 10x faster compilation, substantially reduced memory usage, and far better scalability for massive TypeScript projects. If you spend time in JetBrains IDEs (iykwim), you’ll probably notice snappier startup times too 😉.

For instance, tsgo cuts VS Code’s compilation time from 77.8s to just 7.5s - a staggering 10.4x speedup. Here’s how other popular projects compare -

Project LOC tsc tsgo Speedup
VS Code 1,505,000 77.8s 7.5s 10.4x
Playwright 356,000 11.1s 1.1s 10.1x
TypeORM 270,000 17.5s 1.3s 13.5x
date-fns 104,000 6.5s 0.7s 9.5x
tRPC (server + client) 18,000 5.5s 0.6s 9.1x
rxjs (observable) 2,100 1.1s 0.1s 11.0x

These numbers highlight a fundamental shift in TypeScript development; dramatically faster builds and smoother workflows.


Beyond raw speed, tsgo substantially reduces memory usage, making it more efficient for large-scale projects. Developers using IntelliSense will also notice major improvements in responsiveness, as type checking becomes significantly snappier.

Switching to tsgo is as simple as updating your build script -

{
  "scripts": {
    "build": "tsc -p tsconfig.json"
    "build": "tsgo -p tsconfig.json"
  }
}

With TypeScript 7.0, tsgo will become the fully native toolchain, while TypeScript 6.x remains an option for compatibility.


But… why Golang?

A burning question

Why not Rust, Zig, or something from the C-family?

The answer is simple - Golang is structurally close to the existing TypeScript codebase, so the team could port it file by file instead of rewriting it. It also compiles into a fast, standalone binary.

More importantly, Golang excels at concurrency. Its lightweight goroutines and built-in parallel execution model making it ideal for compilers, efficiently handling tasks without complex threading.


What does this mean for us at Appwrite?

At AppwriteAppwrite is an open-source backend platform for building modern apps. Try Appwrite Cloud., we use TypeScript extensively on our frontend, alongside Svelte for the UI. While our codebase isn’t particularly TypeScript-heavy, tsgo could still offer noticeable performance benefits.

Project LOC Svelte TypeScript Other TS LOC
Console 71,143 83.2% 16.3% 0.5% 11,596
Website 176,958 83.6% 9.1% 7.3% 16,103

Given our relatively lean TypeScript footprint, the impact might not be as dramatic as in larger codebases. Still, any boost in build times and developer experience is always a win.


Official Announcement