The primary motivation for rewriting the TypeScript compiler in Go wasn't just the 2-3x performance gain. It was to escape JavaScript's single-threaded model and access shared memory concurrency, which is essential for utilizing modern multi-core CPUs and couldn't be achieved with web workers.
For a project with a massive user base like TypeScript, a full rewrite is toxic because it inevitably introduces breaking changes. The team chose to port the existing code to Go, preserving the exact algorithms and behavior to ensure backward compatibility and keep the ecosystem happy.
Go was selected for the native port because its built-in garbage collection could handle the TypeScript compiler's many circular data structures. Rust's borrow checker would have required a fundamental redesign of these structures, violating the team's "port, don't rewrite" principle.
When migrating a large codebase, asking an LLM to perform the translation is risky due to its non-deterministic nature. A better approach is to enlist AI to help write a custom, deterministic translation program. This contains the AI's stochasticness to the tool-building phase, not the execution phase.
AI models are most effective with languages they have seen the most in training data, like JavaScript and Python. This creates a feedback loop where AI makes developers more productive in these languages, further cementing their dominance and raising the barrier for new niche languages to gain traction.
The proliferation of AI agents that constantly write and test code makes tooling performance critical. A two-minute compile time, an annoyance for a human, becomes a massive bottleneck for an automated agent that might trigger it hundreds of times, justifying major optimization efforts.
C# creator Anders Hejlsberg felt less happy and effective when his role shifted entirely to high-level design. He argues that even senior architects must stay hands-on with some coding to remain grounded in the practical realities of the codebase and lead more effectively.
TypeScript's success over its competitor, Flow, was partly due to being "self-hosted" (written in TypeScript). This lowered the barrier for the JavaScript community to contribute. In contrast, Flow was written in OCaml, requiring contributors to learn a completely different language and ecosystem.
The idea for TypeScript came when a team wanted to transpile C# to JavaScript solely to get better tooling. Anders Hejlsberg realized the core problem wasn't JavaScript, but its poor developer experience. This led to improving JavaScript with a type system rather than trying to replace it.
Anders Hejlsberg's advice is to disregard people who claim an idea is impossible. This feedback often reflects the limits of their own capabilities or imagination, not an objective truth. Believing in your own ability to solve the problem is paramount, as he proved with projects like Turbo Pascal.
