The Spectrum Dispatch News

technology

Cloudflare and VoidZero Unveil tsrs, a Rust Port of TypeScript Compiler

The new tool achieves up to 8x faster performance and 70% lower memory usage than TypeScript 7.0, while maintaining compatibility with the original language.

Cloudflare and VoidZero Unveil tsrs, a Rust Port of TypeScript Compiler

Cloudflare and VoidZero, working with Max Schwenk of Owner.com, have announced tsrs, a Rust-based port of the TypeScript compiler. According to Cloudflare’s blog, the project operates in close collaboration with the TypeScript team and is incubated as part of the Oxc JavaScript compiler toolchain.

Cloudflare and VoidZero Unveil tsrs, a Rust Port of TypeScript Compiler

The effort aims to help developers reduce time spent waiting for code checking and type verification. Cloudflare notes that a faster, more memory-efficient TypeScript can expand development environments to new contexts, including directly in web browsers.

Cloudflare emphasizes that tsrs is not a fork of TypeScript. The company states that the TypeScript team should retain full control of the language’s design and direction. Because the TypeScript team intentionally explores options over years before implementing features, a Rust port must closely follow those decisions to avoid incompatibility. According to the source text, “we have to preserve the TypeScript language strictly based on its original implementation.”

Early benchmarks show promising results. According to Cloudflare, tsrs is up to 8x faster and uses approximately 70% less memory compared to TypeScript 7.0 when using the same number of type check workers. Cloudflare notes that some optimizations from tsrs have already been contributed back upstream to TypeScript. The source also mentions that TypeScript 7.1 beta achieves up to 2.5x faster performance than version 7.0.

Rust was selected for several reasons. Unlike Go, which requires its garbage collector to be compiled into WebAssembly, Rust’s memory management model allows more efficient interactions between WebAssembly guests and hosts. This makes Rust particularly suited for running development toolchains on Cloudflare Workers and in browser environments.

Maintenance will follow a model similar to Vinext, Cloudflare’s Next.js fork. According to the source, daily agents will review changes and track compatibility issues, while nightly runs regenerate a compatibility matrix against the TypeScript test suite. Cloudflare plans to merge tsc-rs and tsrs into a single package supporting all TypeScript features, including Language Server Protocol and content mappers.

Cloudflare plans to experiment with deeper tsrs integrations into its developer toolchain, including potential applications in type-aware lint rules for Oxlint. The company aims to maintain tsrs as a healthy open source project while remaining in close collaboration with the TypeScript team and broader JavaScript community.

Key facts

  • tsrs is up to 8x faster and uses ~70% less memory compared to TypeScript 7.0
  • The port is being developed by Cloudflare, VoidZero, and Max Schwenk in collaboration with the TypeScript team
  • tsrs is incubated as part of the Oxc JavaScript compiler toolchain
  • Rust was chosen partly for its efficient WebAssembly capabilities without requiring a garbage collector
  • An experimental release is available via npm as the tsrs package

Sources

← All posts