Why TypeScript Won the AI Era: Anders Hejlsberg on Types, Performance, and Machine-Assisted Code

Anders Hejlsberg on how TypeScript became the most-used language on GitHub in 2025, why AI tools favor typed languages, and the 10X compiler rewrite that kept backward compatibility intact.

Why TypeScript Won the AI Era: Anders Hejlsberg on Types, Performance, and Machine-Assisted Code

TL;DR

  • TypeScript became the most-used language on GitHub in 2025, overtaking JavaScript and Python
  • AI coding tools favor TypeScript because types act as truth checkers for generated code
  • The compiler was rewritten in Go for a 10X performance boost while preserving backward compatibility
  • If you're building AI-assisted workflows or large codebases, TypeScript's static typing is now table stakes

The Big Picture

When Anders Hejlsberg started TypeScript in 2012, he thought 25% adoption would be a win. In 2025, TypeScript became the most-used language on GitHub—surpassing both JavaScript and Python. Over a million developers started contributing in TypeScript this year alone, a 66% year-over-year jump according to Octoverse data.

This isn't just a popularity contest. TypeScript's rise maps directly to the shift toward AI-assisted development. As we covered when TypeScript first overtook Python, developers are gravitating toward typed languages because they make machine-generated code safer and more maintainable. Anders puts it bluntly: "If you ask AI to translate half a million lines of code, it might hallucinate. But if you ask it to generate a program that does that translation deterministically, you get a reliable result. That's the kind of problem types were made for."

The language that started as a pragmatic fix for JavaScript's scaling problems has become the foundation for how humans and machines write code together. Here's why that happened, and what it means for how you build software in 2025.

How TypeScript Became the Default

TypeScript's original pitch was simple: add static types to JavaScript without breaking anything. It compiles to plain JavaScript, so it runs anywhere. It catches type errors before runtime, so you ship fewer bugs. It improves IDE autocomplete and refactoring, so large teams can move faster.

The magic was making it feel like JavaScript with superpowers, not a different language. Nearly every modern frontend framework—React, Next.js, Angular, SvelteKit—now scaffolds with TypeScript by default. Backend systems built on Node.js and Deno use it. SDKs, design systems, and increasingly, AI-driven agent frameworks all rely on TypeScript's type system to keep generated code safe.

Anders reflects on the early days: "We didn't set out to be everywhere. We just wanted developers to be able to build big systems with confidence." That confidence came from a philosophy of evolution over revolution. TypeScript doesn't force you to rewrite your codebase every few years. It stays compatible, adds features incrementally, and preserves behavior even when the internals change.

This year's Octoverse data backs up the evolutionary model: developers pushed nearly 1 billion commits in 2025, and 1.12 billion of those were to public and open source repositories. TypeScript's own repository—twelve years of issues, pull requests, and design notes—is a living archive of language evolution. "It's evolution you can grep," Anders says.

The 10X Compiler Rewrite

TypeScript was famously self-hosted: written in TypeScript itself. That kept the compiler portable and hackable. But as codebases grew to millions of lines, performance became a bottleneck.

"As much as it pained us to give up on self-hosting, we knew we couldn't squeeze any more performance out of it," Anders says. The team experimented with C# and other languages before settling on Go. The result: a 10X performance gain. Half from being native code, half from shared-memory concurrency.

The new compiler is faster, leaner, and more scalable for enterprise-scale codebases. But here's the critical part: it's functionally identical to the old one, down to the quirks. "We have a native compiler that's a carbon copy of the old one," Anders says. "The community doesn't have to throw anything away."

This philosophy—preserving behavior while improving performance—is why developers trust TypeScript. It's not a clean-slate rewrite every few years. It's an evolutionary system built to stay compatible. You get the speed boost without the migration tax.

What This Changes For Developers

The shift toward TypeScript isn't just about language preference. It's about how AI tools interact with your code. GitHub's own internal teams use Copilot to build GitHub, and they've found that typed languages make AI-assisted workflows more reliable.

Anders explains why: "AI's ability to write code in a language is proportional to how much of that language it's seen. It's a big regurgitator, with some extrapolation. AI has seen tons of JavaScript, Python, and TypeScript, so it's great at writing them. New languages are actually disadvantaged."

That data familiarity, combined with TypeScript's static type system, makes it uniquely fit for an AI-first workflow. Types aren't bureaucracy. They're truth checkers. When an AI agent refactors your codebase or generates a new module, the type system catches errors that would otherwise ship to production.

The rise of large language models is also changing what "developer tools" even mean. IDEs are becoming environments not just for developers, but for agents. "AI started out as the assistant," Anders says. "Now it's doing the work, and you're supervising. It doesn't need an IDE the way we do. It needs the services. That's why all this Model Context Protocol work is exciting."

Typed languages like TypeScript give agents the structure they need to refactor safely, answer semantic queries, and reason about codebases in a deterministic way. The goal, Anders adds, is to "box in AI workflows with just enough determinism that they stay useful without going off the rails."

Try It Yourself

If you're still writing JavaScript without types, the migration path is straightforward. TypeScript is a superset, so you can rename .js files to .ts and add types incrementally. Most modern frameworks scaffold with TypeScript by default:

# Create a new Next.js project with TypeScript
npx create-next-app@latest my-app --typescript

# Or add TypeScript to an existing Node.js project
npm install --save-dev typescript @types/node
npx tsc --init

For AI-assisted workflows, the combination of TypeScript and tools like GitHub Copilot or Cursor means you get autocomplete that understands your types, refactoring that doesn't break contracts, and generated code that passes type checks before you even run it.

The TypeScript compiler itself is open source and actively maintained. The repository on GitHub contains twelve years of design discussions, feature proposals, and bug fixes—all searchable, all public. If you want to understand how a language evolves in the open, it's a masterclass.

The Bottom Line

Use TypeScript if you're building anything larger than a weekend prototype, especially if you're using AI coding tools. The type system catches errors that LLMs miss, and the tooling ecosystem is now the default for modern JavaScript development. Skip it if you're writing throwaway scripts or working in environments where JavaScript is mandated and you can't control the build pipeline.

The real opportunity here isn't just adopting a typed language. It's understanding that the shift toward TypeScript reflects a deeper change: code is now written by both humans and machines, and the languages that win are the ones that make that collaboration safe. TypeScript didn't become the most-used language on GitHub by accident. It became the default because it makes complex software simpler to reason about—whether you're the one writing it or an AI agent is.

The risk of ignoring this shift is shipping codebases that are brittle, hard to refactor, and incompatible with the AI-assisted workflows that are now standard practice. TypeScript isn't a trend. It's the new baseline.

Source: GitHub Blog