Software Engineering

Cloudflare and VoidZero announce tsrs, a Rust port of TypeScript compiler

Key Takeaway

Cloudflare, VoidZero and Max Schwenk are developing tsrs, a faithful Rust port of the TypeScript compiler incubated within the Oxc toolchain, with early benchmarks showing up to 8x speed and ~70% memory reduction versus TypeScript 7.0.

Summary

Cloudflare and VoidZero are collaborating with Max Schwenk of Owner.com on tsrs, a Rust port of the TypeScript compiler. The project is being incubated as part of the Oxc JavaScript compiler toolchain and developed in coordination with the official TypeScript team, who retain full control over language design. An experimental release is available on npm. The initiative aims to improve performance and enable TypeScript tooling in constrained environments like browsers and edge platforms through WebAssembly.

Why Rust instead of Go for TypeScript

  • Performance: tsrs is up to 8x faster than TypeScript 7.0 with the same worker count, and uses ~70% less memory; some optimizations have already been upstreamed to TypeScript 7.1 beta
  • WebAssembly advantage: Unlike Go, Rust compiles to Wasm without bundling a garbage collector, enabling more efficient memory interaction between Wasm guest and host
  • Maintenance model: Automated agent-based sync with upstream TypeScript, similar to Cloudflare's Vinext/Next.js approach; daily compatibility matrix regeneration against TypeScript test suite
  • Scope: Will merge with tsc-rs to support full TypeScript including LSP and content mappers; not a fork, aims for behavioral parity with upstream
  • Adaptive config: Default tsrs configuration adjusts to machine type, trading more memory for additional speed

Why it matters

The Rust port could enable complete TypeScript development environments to run in browsers, embedded devices, and edge platforms like Cloudflare Workers where Go's GC overhead is prohibitive. Cloudflare plans deeper integration with Oxlint for type-aware linting.

What to do

  • Install the experimental tsrs package from npm with 'npm install tsrs' and run it with 'npx tsrs' if you want to try the Rust port of the TypeScript compiler.
  • Watch for the upcoming stable release if you need full behavioral parity with upstream TypeScript, as some diagnostic ordering differences remain in the current version.
  • Expect performance and memory improvements to be upstreamed to TypeScript itself, since some tsrs optimizations have already been incorporated into TypeScript 7.1 beta.

Original reference: blog.cloudflare.com →