Skip to content

TypeScript & Golang

Published: March 14, 2025

3 min read


TypeScript & Golang

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 -

ProjectLOCtsctsgoSpeedup
VS Code1,505,00077.8s7.5s10.4x
Playwright356,00011.1s1.1s10.1x
TypeORM270,00017.5s1.3s13.5x
date-fns104,0006.5s0.7s9.5x
tRPC (server + client)18,0005.5s0.6s9.1x
rxjs (observable)2,1001.1s0.1s11.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 compiles directly into a standalone binary, making it fast and efficient.

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 Appwrite, 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.

ProjectLOCSvelteTypeScriptOtherTS LOC
Console71,14383.2%16.3%7.3%11,596
Website176,95883.6%9.1%5.7%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

Darshan Pandya