You want a faster TypeScript compiler, but Microsoft already shipped one in Go, so why would anyone rewrite TypeScript in Rust? Theo's answer: garbage collection blocks WebAssembly, and only a Rust port can run the whole compiler inside a V8 isolate.
What Is the TypeScript in Rust Rewrite?
TypeScript in Rust, released by Theo (t3.gg) as tsc-rs, is an AI-agent-built port of the TypeScript compiler, type checker and language server from JavaScript to Rust. Theo reports it works as a near drop-in replacement for the Go-based compiler Microsoft ships as TypeScript 7.
The project exists because, in Theo's telling, no model could complete the port for months, which made it his benchmark for AI capability. The result ships as a real npm package, and the TypeScript language it mirrors remains Microsoft's typed superset of JavaScript that compiles to plain JS for the browser.
Compatibility is the headline claim: of six issues opened on the repository, Theo says only one was specific to the Rust port. The other five reproduced bugs already present in the Go-based TypeScript 7 the port targeted, meaning the rewrite faithfully carried over defects from the original.
Why the Port Cost $420,000 on Paper
The famous $420k figure is a sticker price, not a bill anyone paid. Theo says he burned roughly $400,000 of OpenAI API-priced tokens, peaking at about 84% compatibility against TypeScript 6, and got nowhere near done.
The successful leg used Claude, Anthropic model family, through Claude Code, Anthropic agentic terminal coding tool. Theo reports about $20,000 of full API-rate inference across six subscription accounts, but because he was on Claude subscriptions, the actual subscription-equivalent usage came to roughly ten weekly limits, which he values at about $500.
The lesson he draws is about economics: the same task that cost $400k of tokens on one model family became a two-week, roughly $20k job on a newer model, and nearly free on a subscription plan.
How Agents Ported the Go Version, Not JavaScript
The agents did not port JavaScript to Rust directly. Microsoft's team had already hand-ported the compiler line by line into Go as TypeScript's native compiler effort (tsgo), and the agents used that Go code as their source.
Theo says the model even ported parts of the Go standard library and a goroutine-style runtime into Rust to keep the translation faithful. The first working output was two to three times slower than the Go version. He then set a goal: at least 2x faster in every way, and let it run for two weeks with parallel workflows and sub-agents across multiple machines.
His own role, as he describes it, was managerial: auditing blockers, watching failure modes, and adjusting the environment so agents could work in parallel without stepping on each other. He says he never read a line of the produced code.
How Fast Is TypeScript in Rust?
Theo's published numbers, measured by him on real projects, are vendor-side claims rather than an independent benchmark suite. Against TypeScript 6, the last compiler written in JavaScript, he reports 12.5x to 20x speedups depending on the project. Against TypeScript 7, Microsoft's Go build, he reports roughly 2x.
Bun, the JavaScript runtime project, also shipped bun check, its own Rust-based TypeScript checker, which Theo says is even faster than his port on raw checks. But he notes bun check raised incorrect errors on Sentry and tRPC codebases, and he recommends his port for projects needing faithful diagnostics, while still recommending Bun overall for its maintenance outlook.
One caveat: the t3.code numbers benefit from an Effect-TS fork built into the Rust port, so that comparison is not a pure compiler-speed test against Bun's checker running the same workload.
Why Go Suits Microsoft and Rust Suits Agents
Theo defends Microsoft's Go choice. Go offers built-in concurrency, JavaScript-like syntax, and garbage collection. For a compiler that runs for seconds, an occasional GC pause is negligible, whereas it would be unacceptable for a millisecond-latency web service.
Rust's advantage is different: no garbage collector. That makes WebAssembly targets practical, which is exactly why the Go-based esbuild, Evan Wallace's Go bundler at esbuild, struggled for years to ship a small WASM build. A Rust compiler port compiles to small, predictable WASM with ease.
The Real Goal: a Full Dev Loop Inside a V8 Isolate
Theo says performance was never the point. The point is that a Rust compiler can be compiled to WebAssembly and run inside a V8 isolate, the sandboxed JavaScript execution layer used by Chrome tabs and Cloudflare Workers, Cloudflare's edge compute platform. Isolates share one Linux host instead of giving every tenant a container or VM, which is why Workers can be cheap.
Isolates have no filesystem and no native code, so agents cannot build inside them the normal way. Combining just-bash, Vercel's in-memory fake bash environment for agents, with the WASM-compiled Rust compiler, Theo demoed an agent building a complete working app entirely inside a V8 isolate on Node, using under 260 MB of RAM and peaking near 4% CPU, by his account.
His argument: model inference costs fall fast, while VM and RAM rental costs rise with AI demand. If that trend holds, per-thread VMs become the expensive part, and running agents and their build tools in cheap isolates becomes the scaling path.
Caveats Before You Switch Compilers
Treat this as an early project, not a settled default. Performance figures come from the project's author, not an independent lab. Bun's checker is faster in some checks, and Theo himself recommends Bun as the safer long-term bet for most projects.
The port also carries over TypeScript 7's own bugs by design, and the numbers mixing Effect-TS patches into some comparisons mean results vary by codebase. Verify against your own project before adopting any of these tools.
FAQ
- Is tsc-rs a drop-in replacement for TypeScript? Theo reports near-full compatibility with the Go-based TypeScript 7, including its bugs. It ships on npm, but you should validate it on your own codebase before relying on it in CI.
- Did the AI really rewrite TypeScript in Rust without human code review? Theo states he read none of the code and worked through goals, audits and environment setup. The agents ported Microsoft's Go version and then optimized it past 2x the Go performance, per his measurements.
- Why not just use Microsoft's Go compiler? For most projects, the Go compiler is the sensible choice and Theo says so. The Rust port matters for WebAssembly and in-isolate use cases, where Go's garbage collector makes small WASM builds impractical.
- How much did the port cost? Theo reports about $400k of OpenAI tokens wasted, then roughly $20k of API-rate Claude inference for the successful run, which his subscriptions reduced to an equivalent of about $500 of weekly-limit usage.
Turn Your Own Videos Into Articles
This piece started as a 48-minute video, and the clearest signal in it was how much explanation lives in speech that never becomes text. If you publish deep technical walkthroughs on YouTube, that same knowledge can reach readers who search instead of watch. Skalablog turns a YouTube URL into a transcription, then into a structured, source-linked article you review before publishing.
If your videos explain projects like this TypeScript in Rust port, or you teach TypeScript itself, written companions help that content get found. Developers such as Gustavo Dev Doido have built full TypeScript courses like CrazyStack Typescript, and pairing video lessons with searchable articles is a natural next step. Paste a video link at skalablog.com and see what your transcript becomes.
Fork this article
Start a new branch from the same video, shaped your way. You keep the credit; the original keeps the attribution.
A fork in another language is filed as a translation of this article, so the two pages point at each other. You can unlink it later from the editor.
0/240
You are creating
- Format
- For
- Language
- Source
- Your angle
You will be asked to sign in before it is generated.
Buy credits