LLM Porting the TypeScript Compiler to Rust: A New Experiment in AI-Driven Code Migration

A developer experiments with using LLMs to port the TypeScript compiler to Rust, testing the real limits of AI coding.
A developer shared on Hacker News an experiment using LLMs to port TypeScript's compiler, type checker, and LSP to Rust, drawing 48 upvotes and 77 comments. The core motivation mirrors Microsoft's own Rust-based TypeScript compiler work: performance and memory safety. The community is divided — supporters see it as an ideal "translation" task for LLMs, while skeptics point to edge cases, correctness demands, and idiomatic Rust requirements that likely exceed current AI capabilities. The project's real value lies in what it reveals about the boundaries of AI engineering: human oversight and continuous testing remain essential.
A Bold Experiment: Letting AI Handle a Language Port
Recently, a project on Hacker News sparked widespread discussion in the tech community — a developer attempted to use large language models (LLMs) to port TypeScript's compiler, type checker, and Language Server Protocol (LSP) implementation to Rust. The post earned 48 upvotes and 77 comments, and the buzz reflects just how much attention developers are paying to AI-assisted migration of large codebases.
This is no toy project. TypeScript's compiler is an extraordinarily complex codebase, encompassing tightly coupled subsystems for lexical analysis, syntax parsing, type inference, and type checking. Porting it from TypeScript (a JavaScript ecosystem language) to Rust — a memory-safe, performance-oriented systems language — has traditionally required senior engineers to invest significant time in manual rewrites. Attempting to automate this process with an LLM is, without question, a probe into the current boundaries of AI programming capability.
Why Port to Rust?
The motivation for porting the TypeScript toolchain to Rust isn't hard to understand. Performance is the primary driver — compilers running on a JavaScript runtime are speed-limited when handling large projects, while natively compiled Rust binaries can significantly accelerate both compilation and type checking. This is precisely the logic behind Microsoft's recent work on a Rust-based TypeScript compiler (known as "tsgo" / the native TypeScript 7.0 version).
Beyond speed, Rust's memory safety guarantees, concurrency model, and runtime-free deployment make it an ideal choice for compiler infrastructure. The LSP, which powers the intelligent suggestions in modern editors, is especially latency-sensitive — rewriting it in Rust can deliver a noticeably smoother development experience.
What makes this project special, however, is how the migration is being done: it attempts to hand the engineering work to an LLM rather than humans. This cuts to a critical question — can AI handle a code translation task of this scale and complexity?
What is the LSP? The Language Server Protocol (LSP) is an open standard proposed by Microsoft in 2016, designed to decouple a programming language's smart features (auto-completion, go-to-definition, real-time error highlighting) from individual editors. Before LSP, every editor (VS Code, Vim, Emacs, etc.) had to implement a separate plugin for every language — an "M×N" maintenance burden. LSP reduces this to "M+N": a language only needs one server, and an editor only needs one client. TypeScript's LSP implementation directly affects the real-time coding experience of millions of developers, and its response latency is extremely perceptible to users — a key motivation for porting it to the more performant Rust.
The Core Debates in Community Discussion
With 77 comments, the community's attitude toward this kind of AI-driven code migration is clearly mixed.
Supporters argue that compiler porting is fundamentally a task with a "clear reference point": the source logic already exists and has been thoroughly tested; the LLM simply needs to understand that logic and re-express it in the target language. Compared to generating something from scratch, this kind of "translation" work is precisely where large models tend to perform relatively well — and a comprehensive test suite can continuously validate correctness.
The skeptical voices are equally worth heeding. Compilers are riddled with subtle edge cases, performance optimization tricks, and accumulated historical logic — the parts that are hardest for AI to accurately capture. The type checker demands extreme correctness; even minor semantic deviations can cause incorrect type inference results, cascading through the entire ecosystem that depends on it. There's also the question of whether LLM-generated Rust code will conform to idiomatic Rust patterns, rather than being a naive line-by-line translation — a key benchmark for migration quality.
What is "idiomatic Rust"? "Idiomatic Rust" is a key concept for evaluating migration quality. Rust has unique memory management mechanisms — ownership, borrowing, and lifetimes — that are not just syntactic requirements but profoundly shape architectural design. TypeScript's compiler makes heavy use of mutable shared state, reference cycles, and other patterns that feel natural in garbage-collected languages, but which often require fundamental data structure redesigns in Rust. If an LLM simply performs a line-by-line syntactic translation, the resulting code may rely heavily on constructs like
Rc<RefCell<T>>to escape Rust's type system — ultimately failing to deliver Rust's performance benefits while also increasing maintenance burden. Evaluating a migration like this requires looking not just at functional correctness, but at whether the generated code genuinely embraces the target language's idiomatic patterns.
Real-World Lessons for AI Programming Capability
The value of this project may not lie in whether it successfully completes the port 100%, but in what it reveals as a window into AI's engineering capabilities.
Cross-language migration of large codebases is one of the most expensive tasks in software engineering, requiring a comprehensive mastery of two language ecosystems, compiler theory, and a vast amount of tacit knowledge. If an LLM can incrementally complete such tasks under human supervision — even if it only handles 70–80% of the baseline translation work, with engineers reviewing and refining the rest — that alone represents a massive productivity gain.
At the same time, it's a reminder to stay clear-eyed. Systems like compilers, where correctness requirements are strict, are unlikely to be fully handed off to AI autonomously anytime soon. Human-AI collaboration, continuous test validation, and rigorous review of AI output will remain necessary conditions for projects like this to succeed in practice.
Conclusion
Using an LLM to port the TypeScript toolchain to Rust is a pragmatic experiment at the frontier of AI programming. It showcases the potential of large models on structured tasks with clear reference points, while also exposing the real challenges they face when handling high-complexity, high-correctness scenarios. For developers tracking the evolution of AI-assisted programming, projects like this are worth following closely — they are drawing, in real time, the line between what AI can handle and what it cannot yet.
Related articles

Structuring Data for AI Agents: Five Approaches and a Selection Guide
There's no single best way to structure data for AI Agents. This article compares semantic models, knowledge graphs, RAG, Markdown+grep, and open formats, drawing on research from dbt, Microsoft, and Chroma to help you pick the right data architecture based on question type.

Fish Audio Drama 3 Open-Source Launch Sparks Debate: The 35B Speech Model's Selling Points and Licensing Controversy
Fish Audio Drama 3 sparks debate with 35B parameters and open weights, ranking first on pronunciation benchmarks with director-style control and word-level inpainting, but its community license restricts commercial resale, API prices are rising, and local runs need ~39GB VRAM.

curl 8.23.0 Fixes 24 CVEs, AI-Assisted Research Contributed 20
curl 8.23.0 fixes 24 CVEs, 20 found by AI-assisted research, including a High-severity HTTP/2 use-after-free that could become RCE. Here's the source, fix details, and upgrade checklist.