DEV Community

Cover image for tsrs Is a Rust Port of TypeScript That Runs in the Browser. Try It in CI First
Mango Developer
Mango Developer

Posted on Originally published at mangodeveloper.com

tsrs Is a Rust Port of TypeScript That Runs in the Browser. Try It in CI First

Two months ago I had finally stopped talking about TypeScript compile times. The Go rewrite in TypeScript 7.0 had made the problem small enough to ignore. Then Cloudflare published a blog post about a Rust port, and here we are again.

The project is called tsrs, announced on October 20. Cloudflare and VoidZero are working on it with Max Schwenk of Owner.com, and they say they are doing so in close collaboration with the TypeScript team. It's experimental, you can try it right now with one command, and it comes with benchmark numbers that deserve a careful read. I'll go through what it is, why Rust is the point, what's missing, and how I'd test it without risking anything.

What tsrs actually is

Cloudflare calls tsrs a Rust port of the TypeScript compiler, incubated as part of the Oxc JavaScript compiler toolchain. The post is emphatic about two things.

First, it is not a fork. Cloudflare says the TypeScript team should remain in full control of the language's design and direction. A port has to follow upstream decisions closely, or it falls apart and becomes incompatible. So tsrs aims to be a faithful port of how TypeScript works, not a new dialect.

Second, it isn't the only Rust effort. Cloudflare says it is working with Theo Browne to merge tsc-rs and tsrs into a single package that supports all TypeScript features, including the Language Server Protocol and content mappers.

You can try the experimental release from npm:

CodeCopy

Enter fullscreen mode Exit fullscreen mode

npm install tsrs
npx tsrs

Enter fullscreen mode Exit fullscreen mode

The numbers, and how to read them

Cloudflare's early benchmarks claim tsrs is up to 8x faster and uses about 70 percent less memory than TypeScript 7.0, when both use the same number of type-check workers. By default tsrs ships with an adaptive configuration that depends on the machine type. It uses more memory but is even faster.

The company also makes a point I appreciate. You may have seen other benchmarks of TypeScript ports with bigger claims. Cloudflare says those often use larger machine types and different options than TypeScript's defaults, and that for this comparison it worked with the TypeScript team to make sure the configuration was the same. Write-ups elsewhere quote bigger gaps, including 18x on the VS Code codebase from byteiota. I'd treat the 8x as the conservative figure and your own repo as the only one that counts.

Then there's the part that makes this more than a Rust-versus-Go contest. Cloudflare says the next TypeScript, version 7.1 beta, is already up to 2.5x faster than 7.0, and that some of those optimizations were upstreamed from tsrs. So even if you never run tsrs, you probably benefit from it. That is how a healthy competing implementation should work.

For one real data point, JavaScript Weekly notes that Schwenk says the port took his company's typecheck from 80 seconds to 7. One company, one codebase. Interesting, not a guarantee.

TypeScript logo from Wikimedia Commons

Expand

TypeScript logo from Wikimedia Commons

Image: Microsoft via Wikimedia Commons, Public domain

Why Rust, if Go already made TypeScript 10x faster

This is the question I asked first. The TypeScript team's Go port, shipped as TypeScript 7.0 in July 2026, made the compiler roughly ten times faster than the old JavaScript one, according to Cloudflare. So why another rewrite?

The answer is WebAssembly. When you compile a Go program to Wasm, you have to compile Go's garbage collector along with it. Rust's memory model makes interaction between a WebAssembly guest and its host straightforward. Cloudflare Workers have supported Wasm for a long time, and the company says it recently announced native Rust support in Workers through a new Emscripten target for wasm-bindgen.

What that allows, in Cloudflare's words, is running a development toolchain end to end in a fully sandboxed environment: type checking at the edge, in a browser tab, on an embedded device, or inside a CI runner that doesn't need a full Node or Go runtime. If you're building an online IDE, a code-review tool that type-checks in the browser, or an agent that runs checks in a sandbox, that matters.

There's also a candid explanation for the timing. Cloudflare says only one port of TypeScript to another language ever fully succeeded: the team's own move from JavaScript to Go. But frontier AI models can now do large ports almost independently in days, and the company has seen "slopforks", faithful ports and completely re-architected versions in Rust or C++. Demand for faster TypeScript is clear. I think that's a refreshingly honest statement.

What's missing today

This is an experiment, and the gaps are real.

  • No watch mode and no language server. byteiota's write-up says tsrs cannot replace your editor's TypeScript integration yet. Cloudflare says LSP is part of the merge plan with tsc-rs. The roadmap targets a stable release against TypeScript 7.1 with full conformance, followed by LSP support.
  • Differences from upstream. Cloudflare admits there are differences right now, for example the order in which diagnostics are printed. It aims to cut them to a minimum before a stable release.
  • It chases a moving target. Cloudflare plans to keep tsrs in sync using agents that review upstream changes each morning and run the test suite nightly, the same method it uses for its Next.js-compatible Vinext project. That's clever, but it's also a fresh process. Expect bugs.

What TypeScript 7.1 beta adds

Don't skip the official side. Microsoft announced the TypeScript 7.1 beta on October 20 as well, installable with npm install -D typescript@beta. One headline is support for import attributes in ambient modules, the metadata after the with keyword in imports like with { type: "json" }.

NTCompatible's report adds that 7.1 stabilizes the programmatic API that was left out of the July 2026 Go rewrite. That missing interface had kept tools like Volar, the Svelte language service and typescript-eslint stuck on TypeScript 6.0, and a new content-mapper plugin point is meant to help Vue, Svelte, Astro and MDX hook into the language services. The same report says the release candidate is due November 10 and the stable release November 24. Downstream tools will each need their own updates before most teams can leave TypeScript 6.

That's the real story for framework authors. If your project depends on a language service built on the old API, the timing of 7.1 matters more than any Rust port.

How I'd test tsrs this week

  1. Don't touch your editor setup. Keep the official TypeScript language service for completions and diagnostics.
  2. Add tsrs as a second, non-blocking job in CI. Run npx tsrs next to your normal type-check, and let it fail without failing the build.
  3. Compare outputs. Diff the diagnostics. Differences in message order are expected. Missing or extra errors are bugs worth reporting.
  4. Record time and memory on your CI machine type, not your laptop. Cloudflare's own numbers depend on machine size.
  5. Try TypeScript 7.1 beta the same way, in a branch. With up to 2.5x over 7.0 claimed, it may be all the speedup you need.
  6. Revisit in December. By then TypeScript 7.1 stable should be out, and the tsrs and tsc-rs merge should have a clearer shape.

If you already use a native type checker, my notes on Bun Check and how it compares with tsc cover another option in the same race.

Server hardware in a data center, a stock photo for edge computing

Expand

Server hardware in a data center, a stock photo for edge computing

So who should care?

Large monorepos with slow CI should care first. Teams building browser-based tooling should care second, because Wasm is the unusual advantage here. Everyone else can wait for 7.1 stable and take the free speedup that comes with it.

I like what this competition does to TypeScript. A year ago nobody expected the compiler to be fast. Now two Rust projects and a Go one are racing, and the language team is pulling the best ideas back in. My bet is that the winner for most of us will simply be whatever ships inside the official package.

Frequently Asked Questions

What is tsrs?

An experimental Rust port of the TypeScript compiler from Cloudflare and VoidZero, developed with Max Schwenk and incubated in the Oxc toolchain, with input from the TypeScript team.

How fast is it?

Cloudflare's benchmarks say up to 8x faster and about 70 percent less memory than TypeScript 7.0 using the same number of workers. TypeScript 7.1 beta is up to 2.5x faster than 7.0.

Can it replace my editor's TypeScript?

Not yet. It has no language server and no watch mode, according to current reports.

When does TypeScript 7.1 ship?

The beta arrived October 20. NTCompatible reports a release candidate on November 10 and stable on November 24.


Originally published on Mango Developer.

Top comments (0)