Brifing

Introducing tsrs: A High-Performance TypeScript Compiler Port in Rust

Cloudflare and partners launch tsrs to accelerate TypeScript compilation using Rust and WebAssembly.

Cloudflare Blog2 min

1The tsrs Project Overview

Cloudflare and VoidZero are collaborating with Max Schwenk to develop tsrs, a Rust-based port of the TypeScript compiler. This project is incubated within the Oxc toolchain to enhance developer productivity. By focusing on speed and memory efficiency, the team aims to enable complete development environments to run directly inside web browsers.

2Commitment to Upstream Compatibility

The project explicitly avoids forking TypeScript to maintain the language's original design and direction. Developers believe the TypeScript team must retain full control over feature implementation and long-term vision. By strictly following the official implementation, tsrs ensures compatibility while allowing the core team to explore complex language features without external interference.

3Performance and Memory Benchmarks

Early benchmarks indicate that tsrs is up to eight times faster than TypeScript 7.0 while consuming approximately 70% less memory. These tests utilize identical configurations to ensure accuracy. Some performance optimizations identified during this process have already been upstreamed to the official TypeScript codebase, benefiting the entire JavaScript developer community immediately.

4Strategic Advantages of Rust

While the existing Go port improved performance, Rust offers unique benefits for WebAssembly integration. Rust’s memory management model avoids the overhead of a garbage collector, which is required when compiling Go to Wasm. This efficiency allows for running complex build systems in tight loops, significantly reducing the memory footprint for developers.

5Expanding Deployment Possibilities

The efficiency of Rust and Wasm enables running encapsulated development systems in diverse environments. Beyond Cloudflare Workers, these tools can now operate safely on client-side browsers, embedded devices, or IoT applications. This portability transforms how software build and deployment systems are architected, moving logic closer to the edge or the end user.

6Automated Maintenance and Synchronization

The team plans to merge tsc-rs and tsrs into a single package supporting the Language Server Protocol. Maintenance will mirror the Vinext process, using agents to review daily changes and run the official test suite against the port. This rigorous approach ensures that tsrs remains perfectly synchronized with upstream TypeScript developments.

7Integration with Oxc Ecosystem

Cloudflare intends to integrate tsrs into its broader stack, including potential applications for type-aware linting in Oxlint. As the home for various open-source tools like Vite and Rolldown, Cloudflare aims to make the JavaScript toolchain faster and more portable. The Oxc team is currently refactoring the codebase to ensure long-term project sustainability.

8Future Collaborative Development

The project seeks to foster a healthy open-source ecosystem without obstructing the official TypeScript roadmap. By contributing performance improvements back to the Go-based codebase, the team promotes a collaborative environment. Future efforts will focus on minimizing behavioral differences with the upstream version to reach a stable, production-ready release for all developers.

Original article: Cloudflare Blog — Introducing tsrs: A High-Performance TypeScript Compiler Port in Rust