TS Rust: porting TypeScript to Rust with Opus, and a dev loop inside a V8 isolate
- YT :: https://www.youtube.com/watch?v=ND_kRgU_WlY
- Original title :: You can rewrite typescript in rust for $420k
Theo announces TS Rust, his Rust rewrite of the TypeScript compiler, type checker and LSP. He built it with agents over five months and wrote no code himself. About $400k of Codex tokens at API prices got to roughly 84% compatibility and stalled. About $20-24k of Opus 5.5 finished the job in two weeks, which was roughly $500 of subscription usage. It is a near drop-in replacement for TypeScript 7 (the Go port, TSGO), about 2x faster than it and up to 12.5-20x faster than TypeScript 6. Bun's Rust checker is faster but less faithful. Theo says speed was not the point. The two reasons were that LLMs could not do this port before, and that Rust compiles to small WASM, so the whole TypeScript dev loop can run inside a V8 isolate (for example a Cloudflare worker) with no VM. He expects the cost of compute for agents to become the bottleneck once inference gets cheap enough.
Sponsor: Qdrant
- Vector search and retrieval for agents; open source, written in Rust, cloud or self-hosted.
- Demos: ranked results for vague queries over his videos, T3 Code issues and PRs (no keyword hits vs eight relevant ones), and thumbnail faces ("shrugging", "angry").
Background: TypeScript, tsc and Go
- Turning TS into JS is nearly trivial (esbuild, written in Go by Evan Wallace, does it fast). The hard and slow part is type checking, which is why big codebases split transpilation from type checking (Twitch hot reload went from 30-60 s to under 5 s).
- The type system is Turing complete and encodes all of JavaScript's oddities, so rewriting the checker outside JS is hard. Microsoft still did it, in Go.
- Theo defends Go for this job. Garbage collection causes latency spikes for per-request services, but over a multi-second compile it washes out, and Go's concurrency and JS-like syntax help.
- His 2024 tweet said Go is right for JS tooling and that we might end up all-in on Rust in three years. He says it aged badly for different reasons than expected.
How TS Rust was built
- Opus ported the Go version line by line, including a port of Go's standard library and goroutines (runtime.rs). Go was a viable source language; JavaScript directly was not, as Soul and Astra struggled with it.
- The first working build was 2-3x slower than Go. A /goal of "at least 2x faster in every way" ran for two weeks across six Claude accounts and several machines over SSH.
- Cost: about $24k at API prices, equal to 925-983% of one account's weekly limit, so roughly 10 weekly limits or about $500 of subscription usage.
- Of six issues filed, one is specific to TS Rust; five are bugs in TSC 7 that were ported faithfully.
- Prompts were simple ("I trust your judgment"). The real work was the environment: audit threads, fixing OS-level crashes from memory pressure, parallel agents not stepping on each other, and a better end-state goal when agents kept stopping early.
Performance and comparisons
- On T3 Code, 2x faster than TS7 and up to 20x faster than TSC 6; typically 13x+ over TSC 6 and about 2x over Go across tRPC, Sentry, Excalidraw and Effect.
- The Effect TS language-service plugin is built in. With it, TS Rust is about 4x faster than Bun check plus the Effect check.
- Bun check is faster in raw checking but raised incorrect errors on Sentry and tRPC and could not pass the Effect codebase. Theo would still recommend Bun for most people because he trusts its maintenance more.
Why Rust: the V8 isolate dev loop
- Inference cost per intelligence level falls 10x or more per year (Artificial Analysis data), while VM and RAM prices rise 25-30% per year. Theo expects inference to soon cost less than the VM the agent runs on.
- Agents expect a real Linux box (bash, ripgrep, git, files). Sandboxing harder only adds cost. Cursor cloud currently gives each thread a free 16-32 GB VM; Claude Code now gives credits for cloud compute instead.
- Cloudflare is cheap because code runs in V8 isolates rather than in a VM or container per customer. The limits are no filesystem, no native code and no persistent servers, so isolates suit running code, not building it.
- Go compiled to WASM drags in its garbage collector and is large; Rust compiles to small WASM. That is why TSGO could not move into isolates and TS Rust can.
- Demo: using Just Bash (Vercel's fake bash environment in JS) plus TS Rust, GPT-6.1 Soul built a working app entirely in memory in a V8 isolate. Total use was under 260 MB RAM and about 4% CPU, and it still worked with the filesystem set read-only. An Astra version that bundled with esbuild used about 2x the RAM.
- Idle isolates cost nothing while waiting for the next token, since all apps share one event loop. Theo hints at a related project and wants to confirm it runs on Cloudflare.
Takeaways
- He used this as a "too impossible for models" test; he is now running out of tasks models cannot do.
- Mentions MegaDev, his first paid course for employed developers, with Angie, Kent C. Dodds and John Lindquist.
- Says traditional engineering is dead and that dismissing AI-driven development will cost people jobs. He does not expect most people to use TS Rust and sees it mainly as proof of what is now possible.