All posts
typescripttooling

TypeScript 7 Went Native, in Go, Not Rust

The fastest-feeling upgrade of the year is a compiler port that ignored the Rust wave. What changed when I switched, what didn't, and the tools that have to wait for 7.1.

Muhamad Choirul Adam 2 min readPhoto: Unsplash

TypeScript 7.0 shipped on July 8. It's the native port of the compiler the TypeScript team announced last year, and it's written in Go. After a year of my tooling moving to Rust, the biggest speedup of all came from the one project that chose something else.

What changed

Type-checking got dramatically faster. On our dashboard, tsc --noEmit went from a step I waited for to a step I don't notice. Microsoft reports around 10x on large codebases, and the VS Code team's own check went from about half a minute to a few seconds.

The editor feels it too. Go-to-definition, find references, and errors after an edit come back immediately, even in the biggest files.

What didn't change

Almost everything else, and that's the point. TypeScript 7 behaves like TypeScript 6 on the same code. Same errors, same output. The upgrade is:

pnpm add -D typescript@7

The project config didn't need a single change for us. During the beta, the native compiler shipped separately as @typescript/native-preview with a tsgo binary. With 7.0 it's just typescript again.

Why Go and not Rust

This was the question everyone asked when the port was announced, and the answer holds up. The team wasn't rewriting the compiler, they were porting it file by file so it would behave identically. The existing code relies on garbage collection and on data structures full of cycles. Go has both. Rust would have meant redesigning those parts, and a redesign is exactly how a port stops behaving identically.

The lesson for me: the speedup came from going native and doing it faithfully, not from the specific language.

What has to wait

TypeScript 7.0 doesn't have the full programmatic API yet. That lands in 7.1. Tools that call into the compiler directly, rather than running tsc, keep using TypeScript 6 until then:

  • Some lint setups that do type-aware linting through the old API.
  • Code generators and custom transformers.
  • Older editor plugins.

Our setup handles this by keeping both for now:

package.json
{
  "devDependencies": {
    "typescript": "^7.0.0",
    "typescript-6": "npm:typescript@^6"
  }
}

The CLI and editor use 7. The one tool that needs the old API resolves the aliased 6. I'll delete the alias when 7.1 ships.

The bigger picture

In January I wrote that every JavaScript tool I use was being rewritten in Rust. That was mostly true, and the exception turned out to be the most important tool of all. The common thread isn't Rust. It's that tooling written in JavaScript hit its ceiling, and every project that left found a much higher one.