Cloudflare and VoidZero Port TypeScript Compiler to Rust for Performance Gains
Cloudflare and VoidZero have collaborated to create tsrs, a Rust port of the TypeScript compiler, aiming to significantly boost performance and reduce memory usage.

Cloudflare, in partnership with VoidZero and Max Schwenk of Owner.com, has announced the development of tsrs, a Rust implementation of the TypeScript compiler. This initiative, undertaken in close collaboration with the official TypeScript team and incubated within the Oxc JavaScript compiler toolchain, aims to dramatically improve the speed and memory efficiency of TypeScript code checking.
The primary motivation behind tsrs is to reduce the time developers spend waiting for their code to be validated, thereby increasing productivity. Beyond developer experience, enhanced performance and reduced memory consumption also pave the way for more comprehensive development environments, including those that can run directly within a web browser.
Crucially, the project emphasizes that it is not a fork of TypeScript. The goal is to maintain strict adherence to the original TypeScript language specification and design decisions, with the TypeScript team retaining full control over the language's evolution. This fidelity is essential, as the tsrs port must align with the TypeScript team's long-term vision and implementation choices, which can sometimes involve years of careful exploration before finalization.
Early benchmarks for tsrs are highly promising. Compared to TypeScript 7.0, the Rust port has demonstrated performance improvements of up to 8x and a reduction in memory usage of approximately 70%, when using the same number of type-checking workers. These figures are particularly notable given that TypeScript 7.1 beta itself introduced significant optimizations, some of which were contributed upstream from the tsrs project.
Rust was chosen for this port due to its inherent advantages, especially for environments like WebAssembly (Wasm). Unlike Go, which requires bundling its garbage collector with Wasm, Rust's memory management model facilitates more efficient memory interactions between Wasm guests and hosts. This memory efficiency is critical for Cloudflare Workers, which have long supported Wasm and recently added native Rust support, enabling the efficient execution of demanding workloads.
Maintaining the tsrs port involves a rigorous process designed to keep it synchronized with the upstream TypeScript project. This includes daily agent-driven reviews of changes, fetching diffs, and opening tracking issues. Nightly regeneration of compatibility matrices and running the upstream test suite against the Rust port will identify any discrepancies, which agents will then work to resolve.
Furthermore, any performance improvements identified or developed within tsrs will be contributed back to the official TypeScript Go codebase, benefiting the entire community. While minor differences in diagnostic output order currently exist, the team aims to minimize these before a stable release.
This development aligns with Cloudflare's broader commitment to the JavaScript ecosystem, building upon its existing open-source Rust tools like Vite, Rolldown, and Oxlint. The tsrs project represents a significant step towards enabling more efficient and accessible development workflows, potentially unlocking new possibilities for running complex toolchains in resource-constrained environments.