Cloudflare and VoidZero, in collaboration with Max Schwenk of Owner.com, have launched tsrs, a Rust port of the TypeScript compiler. The project is being incubated as part of the Oxc JavaScript compiler toolchain. The primary objective of tsrs is to reduce developer wait times for type checking while improving memory efficiency. This efficiency is particularly critical for running complete development environments in constrained environments, such as web browsers or embedded devices.

The image serves as the primary visual for the announcement of tsrs, a Rust-based port of the TypeScript compiler.
Early benchmarks indicate that tsrs is up to 8x faster and uses approximately 70% less memory than TypeScript 7.0 when using an equivalent number of type check workers. While the TypeScript team has already made significant performance improvements in recent versions (with TypeScript 7.1 beta showing a 2.5x speed increase over 7.0), tsrs aims to push these boundaries further. A key technical driver for choosing Rust over other languages like Go is its memory management model. Unlike Go, which requires compiling a garbage collector when exported to WebAssembly (Wasm), Rust’s model allows for more straightforward memory interactions between a Wasm guest and host. This makes Rust a superior fit for Cloudflare Workers, where running software build and deployment systems in tight loops benefits significantly from a small memory footprint.
To maintain compatibility with the official TypeScript language, the project emphasizes a faithful port rather than a fork. The team intends to preserve the original implementation's logic while leveraging Rust's capabilities. To keep the port in sync with upstream changes, the team plans to use an automated agent-based workflow similar to the one used for Vinext. This process involves an agent reviewing daily changes, fetching diffs, and identifying gaps in the compatibility matrix. When a discrepancy is found, the agent identifies the change across codebases, builds a reproduction, and proposes a fix. While some minor differences currently exist—such as the order of printed diagnostics—the goal is to minimize these discrepancies as the project moves toward a stable release. The team also intends to contribute discovered performance optimizations back to the official TypeScript Go codebase to benefit the wider community.
One notable technical challenge in porting TypeScript from a garbage-collected language to Rust involves managing long-lived objects. Because Rust lacks a native garbage collector, the port utilizes a unique memory model that employs never-freed arenas for long-living objects to simulate the necessary behavior while maintaining Rust's safety guarantees. This approach allows the compiler to achieve high performance without the overhead of a full runtime, enabling the execution of fully encapsulated development toolchains in sandboxed environments like Cloudflare Workers or client-side in a browser.