# The Model Already Knows TypeScript.

> Stack choice used to be a question of fit. It is now also a bet on training corpus, because a model writes best what it read most. TypeScript is the most used language on GitHub, the agent vendors ship in it, and the type checker hands an agent a feedback loop no untyped language can.

- Canonical URL: https://justinbartak.ai/blog/the-model-already-knows-typescript
- Author: Justin Bartak, Chief AI Officer (https://justinbartak.ai)
- Author entity: https://justinbartak.ai/#person
- Author profiles: https://www.wikidata.org/wiki/Q139551829, https://orcid.org/0009-0005-2615-3624, https://www.linkedin.com/in/justinbartak, https://x.com/justinbartak, https://www.crunchbase.com/person/justin-bartak, https://medium.com/@justinbartak, https://github.com/justinbartak, https://about.me/justinbartak
- Published: 2026-09-24
- Updated: 2026-09-24
- Category: AI Org
- Keywords: AI-native stack, TypeScript for AI agents, why TypeScript and React, training corpus language choice, Next.js AI development, low-resource programming languages LLM, agent code generation accuracy, type checker feedback loop
- Reading time: 8 min read

---

Pick a language for the layer where agents write most of your code and you are no longer choosing for your team. You are choosing the distribution your model samples from.

A model writes best what it read most. That is not a preference, it is an observable property of the systems now producing the majority of new code, and it has a measurable cost when you get it wrong.

**Your stack is now a bet on the corpus, and the corpus is public information.**

## Why does corpus mass decide agent throughput?

Because code-LLM accuracy tracks a language's share of training data, and the imbalance between languages is not subtle.

In The Stack, the dataset behind the StarCoder models, Python and JavaScript each exceed **7% of files**. R sits at **0.04%**. Racket at **0.004%**. D is not represented at all. Research on [transferring capability to low-resource languages](https://arxiv.org/abs/2308.09895) opens by stating the problem plainly: code models produce impressive results on languages well represented in their training data and struggle with languages that are not.

That gap is not a rounding error in your sprint. It is a retry tax charged on every single task: more wrong first passes, more hallucinated APIs, more review attention spent on code that should have been right the first time.

**A more elegant language with a thinner corpus is a slower language now, whatever it does at runtime.**

## Where is the corpus actually concentrated?

Three independent measurements, all pointing the same direction.

**GitHub, by contributors.** In August 2025, [TypeScript became the most used language on GitHub](https://github.blog/news-insights/octoverse/octoverse-a-new-developer-joins-github-every-second-as-ai-leads-typescript-to-1/), with 2,636,006 monthly contributors. It added over 1 million contributors in a single year, growth of 66%, moving ahead of Python at 2.6 million and JavaScript at 2.15 million. That is across 180 million developers and 630 million repositories, with 4.3 million AI repositories that nearly doubled in under two years. GitHub attributes the shift to two things: frameworks that scaffold in TypeScript by default, and AI-assisted development benefiting from stricter type systems.

**npm, by weekly downloads.** Measured the week this was written:

PackageWeekly downloadsWhat it tells you@types/node348,951,646Type definitions are the default, not the exceptiontypescript225,722,105The compiler itself, on a quarter-billion pulls a weekzod223,672,922Runtime validation that mirrors the type layerreact143,911,781The interface layer, an order of magnitude aheadnext45,087,424The framework most of that React ships insidevue12,465,765Roughly 1 tenth of React@angular/core4,798,142Roughly 1 thirtieth of Reactsvelte4,740,654Beloved, and a rounding error in the corpus

Nothing here is an argument about which framework is better designed. It is an argument about what the model has seen 30 times more of.

**The agent tooling layer, by the same measure.** The Model Context Protocol SDK pulls **43,466,247** weekly downloads. The OpenAI client, **29,070,946**. The Anthropic SDK, **28,450,451**. The Vercel AI SDK, **18,500,907**. The tools for building with models are themselves shipping as TypeScript packages, which means every example, every tutorial, and every Stack Overflow answer about agent plumbing feeds the same corpus your agent samples from tomorrow.

## What did the vendors pick when they had to eat their own cooking?

This is the part of the argument I would put in front of a skeptical CTO, because it removes opinion from the discussion.

[Claude Code is built in TypeScript](https://newsletter.pragmaticengineer.com/p/how-claude-code-is-built), with React and Ink rendering the terminal UI, Yoga handling layout, and Bun doing the packaging. Its founding engineer, Boris Cherny, described the choice directly: they wanted a tech stack they did not need to teach, one where Claude Code could build itself.

Roughly **90% of Claude Code is written by Claude**.

Read that as a procurement signal rather than a fun fact. The organization with the most direct information about what its own model is good at chose the stack the model already knew, then handed the codebase to the model. When the people who train the thing pick a stack for capability rather than taste, the rest of us are looking at a published answer.

**The vendors are not writing in the stack they love. They are writing in the stack their model reads fluently.**

## Why do types matter more than they used to?

Because the type checker is the cheapest critic an agent has, and the agent's dominant failure mode is exactly what it catches.

GitHub's own measurement: **94% of LLM-generated compilation errors were type-check failures.** Not logic errors, not architecture failures. Type errors. The class of mistake a model makes most often is the class a compiler catches deterministically, in seconds, with no human in the loop.

That changes what the loop looks like. An agent writing TypeScript gets a machine-readable, unambiguous, cheap signal on nearly every mistake it makes, and it can iterate against that signal while you sleep. An agent writing an untyped language defers the same signal to runtime, to a test that may not exist, or to you.

I hit this today, in this repository. A test file cast a module namespace to `Record>`, which is wrong because one exported constant is a plain string. `npx tsc --noEmit` refused it before the commit, named the incompatible property, and the fix took 30 seconds. Nothing about that error was interesting. That is the point: the interesting errors are the only ones I should be spending attention on, and the type checker is what keeps the boring ones off my desk.

Types are executable intent. They narrow the space of programs an agent is allowed to produce, which is the same reason [tests are the spec now](https://www.orbytlabs.ai/blog/gc-tests-are-the-spec-vibe-coding). A prompt is a request, a type is a constraint, and only one of them is enforced.

## What is the honest counter-argument?

Python still owns two things, and pretending otherwise would be selling you something.

It owns model orchestration, which I have argued at length in [Right Language, Right Layer](https://www.orbytlabs.ai/blog/right-language-right-layer). And it owns evaluation: SWE-bench Verified, the benchmark the entire agentic coding field is scored against, is **500 instances drawn from Python repositories**. The multimodal variant adds 100 JavaScript instances; SWE-bench Multilingual covers 300 tasks across 9 languages. The field's flagship measurement grew up in Python and is only now becoming multilingual.

So corpus mass is a new weight on the scale, not the whole scale. Fitness still decides the layer. What changed is that fitness now includes a term nobody priced five years ago: how much of this language did the model actually read?

For most products, the layer where agents write the most code is the product surface, and on that layer the answer is not close.

## What does being off distribution actually cost?

Three taxes, all of them real and none of them on your balance sheet.

**The retry tax.** Every first pass that comes back wrong is tokens, wall clock, and your review attention. At 1 wrong pass in 3 instead of 1 in 10, you have tripled the cost of the same feature without changing a single requirement.

**The library tax.** Thin corpus means thin typed SDKs, fewer worked examples, and more confidently hallucinated APIs that do not exist. The failure is not that the model refuses. It is that it invents something plausible and you find out later.

**The verification tax.** My audit harness runs 84 dimensions and 100 guards. Most of them are only cheap to write because the language surfaces errors mechanically. A stack that cannot be checked mechanically cannot be [governed at agent speed](https://www.orbytlabs.ai/blog/ai-code-audit-harness), and ungoverned agent speed is just a faster way to ship something wrong.

My own portfolio is the receipt for what that adds up to. [Orbyt](https://www.orbytlabs.ai/about) and the 7 projects beside it run 540,000 lines and 22,058 tests across 8 projects, built and operated solo with agents. Measured by file extension across my application, package, and script directories, TypeScript outnumbers Python by more than 600 to 1. That is not ideology. It is where the leverage was.

## What to do Next

Three moves, in order of how much they will change your next quarter.

**Measure your own first-pass rate by language.** Take the last 20 agent tasks in each language your team runs and count how many landed correct without a human edit. You now have a number nobody in the room can argue with, and it is usually the argument-ending one.

**Put the type checker inside the agent loop, not after it.** If your agent finishes when the model says it is finished rather than when the compiler and tests agree, you are using a fraction of the signal available to you.

**Stop paying the novelty tax on the layer where agents write most of your code.** Choose the boring, enormous, well-documented default there, and spend your originality budget on the parts of the product a model cannot supply.

**The best language used to be the one your team wrote best. It is now also the one your model writes best, and unlike taste, that is a measurable property.**

Related reading:

- [Right Language, Right Layer](https://www.orbytlabs.ai/blog/right-language-right-layer) the per-layer fitness argument this one adds a term to

- [The Stack of Least Resistance](https://www.orbytlabs.ai/blog/the-stack-of-least-resistance) what it costs when the familiar stack wins the decision

- [Single Page, Single Source of Truth](https://www.orbytlabs.ai/blog/spa-front-end-ai-native) why the interface layer converged where it did

- [Your Tests Are the Spec Now.](https://www.orbytlabs.ai/blog/gc-tests-are-the-spec-vibe-coding) the other constraint an agent can iterate against

- [Orbyt Runs on Loops, Not Prompts.](https://www.orbytlabs.ai/blog/gc-loop-engineering) the runtime loop that makes typing work

---

_Originally published on [orbytlabs.ai](https://www.orbytlabs.ai/blog/the-model-already-knows-typescript) on Sep 24, 2026._

---

## Frequently Asked Questions

### Why is TypeScript the best language for AI-assisted development?

Two reasons that compound. It is the most represented language in the corpus these models trained on, so first-pass output is more often correct, and its type checker returns a deterministic error an agent can act on in seconds. Volume decides how often the model is right. Types decide how fast it finds out when it is wrong.

### Does the size of a language's training corpus really change model accuracy?

Measurably. Code-LLM research shows performance tracking a language's share of the training data, and the imbalance is severe: Python and JavaScript each exceed 7 percent of files in The Stack while R sits at 0.04 percent and Racket at 0.004 percent. A more elegant language with a thin corpus costs you retries on every task.

### What stack did the people who build coding agents choose?

TypeScript, React, Ink, Yoga, and Bun. Claude Code's founding engineer said they wanted a stack they did not need to teach, one where the tool could build itself, and roughly 90 percent of Claude Code is written by Claude. The vendors with the most information about model strength picked the corpus, not the language they liked most.

### Does this mean you should write everything in TypeScript?

No. Python still owns model orchestration and the evaluation ecosystem, and SWE-bench Verified is 500 Python instances. Corpus mass is a new weight on the scale, not the whole scale. It matters most on the layer where agents write the most code, which for most products is the product surface itself.

---

Source: https://justinbartak.ai/blog/the-model-already-knows-typescript
Cite as: Justin Bartak, "The Model Already Knows TypeScript.", https://justinbartak.ai, 2026-09-24. https://justinbartak.ai/blog/the-model-already-knows-typescript
