2 min Devops

AI agents rewrite TypeScript compiler in Rust for $24,000

AI agents rewrite TypeScript compiler in Rust for $24,000

Developer Theo Browne used AI agents to rewrite Microsoft’s TypeScript compiler in Rust. The result is said to run twice as fast as Microsoft’s official version, which is based on Go. The implementation also offers nearly full compatibility with existing TypeScript code. 

The experiment required AI models with an estimated API cost of $24,000, according to The Register.

The project, which Browne calls TS_Rust, demonstrates that more powerful AI models for software development enable complex migrations. The developer used Anthropic’s Claude Opus 5.5 to migrate Microsoft’s TypeScript compiler, type checker, and language server to Rust.

According to Browne, his implementation performs 12.5 times faster than the JavaScript-based TypeScript 6. Browne’s version also outperforms Microsoft’s newer Go implementation. However, these claims have not been independently verified.

Browne initially attempted to carry out the migration using OpenAI models. In doing so, he consumed tokens with an estimated API value of over $400,000. That attempt achieved approximately 84 percent compatibility. After that, the process stalled.

Instead of translating the original JavaScript implementation one-to-one, Claude used Microsoft’s existing Go version as a basis. This reduced migration complexity. However, some existing bugs were carried over to the Rust codebase.

The project follows similar developments at major technology companies. For example, Microsoft used AI agents to rewrite its Copilot runtime in Rust, while Google is applying AI-assisted migration techniques to C and C++ projects.

Potential for lighter AI development environments

Beyond compiler performance, TS_Rust could affect the infrastructure needed to run AI-based programming agents.

Current agent-based development environments often use Docker containers or virtual machines to isolate workloads. However, these environments consume significant amounts of memory and computing power.

A TypeScript compiler written in Rust could support lighter-weight execution environments built around Google’s V8 JavaScript engine. Unlike Go, Rust doesn’t require a garbage collector, making it better suited to certain WebAssembly implementations.

Combined with lightweight shell implementations, this approach could let you run certain AI development workloads without needing specific containers or virtual machines.

The potential benefits are still theoretical. TS_Rust is still an experimental project. Nevertheless, the results suggest that AI-assisted software migration is becoming a practical option for increasingly complex codebases.