// 2010 — 2026 · Microsoft · Anders Hejlsberg

TypeScript:JavaScript

A layer of static types over JavaScript that catches errors at compile time. Once dismissed as engineering ceremony — fourteen years later it is GitHub's #1 language by contributors and the native tongue of the Claude Code / Cursor / VS Code generation of AI tools.

#1GitHub's top language 2025
past JS / Python · Octoverse
78%of devs use TS
State of JS 2024
10×compiler speed-up
2025 Go-native rewrite
94%of LLM compile errors are type errors
2025 academic study
: string: number: ReactNodetype Erareadonlyinfer Tsatisfiesas constextendskeyofPromise<T>Partial<T>
scroll
01

What is TypeScript

TypeScript is a superset of JavaScript. Any valid JS is valid TS; TS layers on optional, erasable type syntax. It moves type errors from "found in production at 3am" to "underlined the moment you save the file."

Superset superset

All JS is valid TS, unchanged. Adoption is gradual — file by file, repo by repo.

Erasable erasable

Types only exist at compile time. tsc emits plain JS — browsers and Node never see them. Zero runtime overhead.

Structural structural

Duck typing made formal. Two types are compatible if their shapes match — no inheritance required. Far more flexible than Java's nominal model.

Inference inference

You rarely write types yourself. The compiler infers from assignments, return values, call context. JS-shaped code, TS-grade safety.

user.jsJavaScript
const user = { name: "Anders", age: 64 };

// One typo
console.log(user.naem.toUpperCase());

// → undefined
// → TypeError: Cannot read properties
//   of undefined (reading 'toUpperCase')
// Discovered 3 hours into prod
user.tsTypeScript
const user = { name: "Anders", age: 64 };

// One typo
console.log(user.naem.toUpperCase());
                ~~~~

// ✘ Property 'naem' does not exist
//   on type '{ name: string; age: number; }'.
//   Did you mean 'name'?
// IDE stops you the moment you save
02

History : Timeline

From an internal Microsoft project pitched to Java / C# engineers, to swallowing half of the JavaScript ecosystem, to a 2025 Go rewrite of its own compiler.

  1. 2010

    Internal kick-off

    Anders Hejlsberg — father of Turbo Pascal, Delphi and C# — started a quiet project at Microsoft: give JavaScript a type system strong enough to carry large applications. The codename stayed secret for years; the original team was a handful of people.

  2. 2012·10

    0.8 goes public

    October 1st: TypeScript ships on GitHub. The first release pitched optional static types, classes, and modules. Most of the JS community shrugged at "JS with types"; only the Java/C# crowd was thrilled.

  3. 2013·06

    0.9 — generics arrive

    June 18th. <T> lands in TS. Once generics existed, TS could finally describe container types (Array<T>, Map<K, V>) and the rich signatures of real libraries.

  4. 2014·04

    1.0 stable + Angular bet

    April 12th, at Microsoft Build, TS 1.0 ships. The same year Google decided to rewrite Angular 2 in TypeScript — TS's first major framework endorsement. After this it stopped being "a Microsoft thing."

  5. 2016·09

    2.0 — strict null checks

    September 22nd. --strictNullChecks removed null and undefined from all types — the team's pitch was killing Tony Hoare's "billion-dollar mistake." This is when TS started being type-serious.

  6. 2018

    Vue 3 rewritten in TS + tuples

    September: Evan You announces Vue 3 will be rewritten in TypeScript. That July, TS 3.0 shipped variadic tuples — a leap in expressive power for libraries. The React crowd was migrating en masse around the same time.

  7. 2020·05

    Deno 1.0 — TS as a first-class citizen

    Node's creator Ryan Dahl ships Deno, with TypeScript baked into the runtime — no separate tsc step. TS 4.0 followed in August.

  8. 2022·11

    4.9 — the satisfies operator

    Solves an old wart: how to constrain an object literal by a type without losing its precise literal inference. satisfies became the community's new favorite keyword almost overnight.

  9. 2023·03

    5.0 — modern decorators

    March 16th. Stage-3 ECMAScript decorators land, retiring 7 years of --experimentalDecorators. By this point, TS is already one of the highest-downloaded dev dependencies on npm.

  10. 2024

    State of JS: 78% of devs adopted

    State of JS 2024: ~78% of respondents use TypeScript; over half write mostly TS, almost no plain JS. Five years of straight growth. The same year, Node.js 22+ shipped experimental type-stripping.

  11. 2025·03

    Project Corsa — compiler rewrite in Go

    Anders himself announces a Go port of tsc. The 1.5M-line VS Code codebase type-checks in 7.5s instead of 78s — a 10.4× win. The native build will ship as TypeScript 7.0.

  12. 2025

    GitHub's #1 language

    GitHub Octoverse 2025: TypeScript becomes GitHub's #1 language by contributors for the first time, past JavaScript and Python. Over a million new TS contributors that year, +66% YoY. Code-gen tools of the AI era almost unanimously emit TS.

03

Type System Essentials : TypeAlphabet

The type system is Turing-complete — you can solve SQL queries or compute Fibonacci at compile time, if you must. But 90% of day-to-day work uses the seven primitives below.

A

Type inference

Assignment shape dictates type. For most variables you simply don't write types.

const name = "Anders";
// hover ▸ const name: string

const user = { name: "A", age: 64 };
// { name: string; age: number; }

const tags = ["ts", "js"] as const;
// readonly ["ts", "js"]
B

Unions + type guards

| joins alternatives; typeof / in / discriminant fields narrow each branch.

type Shape =
  | { kind: "circle"; r: number }
  | { kind: "square"; side: number };

function area(s: Shape) {
  if (s.kind === "circle")
    return Math.PI * s.r ** 2;
  return s.side ** 2;
}
C

Generics

Functions, classes and types parameterized over type variables. One implementation, all types.

function last<T>(arr: T[]): T | undefined {
  return arr[arr.length - 1];
}

last([1, 2, 3]);     // T = number
last(["a", "b"]);     // T = string
D

Utility types

A toolbox of built-in type transforms. Change one source type and a slew of derived types track it.

type User = { name: string; age: number };

Partial<User>        // all optional
Required<User>       // all required
Pick<User, "name">   // just name
Omit<User, "age">    // without age
Readonly<User>       // all readonly
Record<string, User> // dictionary
E

Conditional types + infer

If-else at the type level. infer extracts a piece of type from a pattern match.

type IsArray<T> =
  T extends any[] ? true : false;

IsArray<number[]>     // true
IsArray<string>       // false

type ReturnType<F> =
  F extends (...a: any) => infer R ? R : never;
F

Template literal types

String interpolation, but at the type level. Powers IDE features like full-string-path autocomplete.

type Greet<N extends string> =
  `Hello, ${N}!`;

type X = Greet<"World">;
// "Hello, World!"

type Path = `/api/${"users" | "posts"}/:id`;
G

Mapped types

Walk every property of a type and transform it. Utility types themselves are built this way.

type Stringify<T> = {
  [K in keyof T]: string
};

type S = Stringify<User>;
// { name: string; age: string; }

Types as a DSL

Composed together, these seven give you full-arg autocomplete, exhaustive union checking, and one-shot field rename — right in the editor.

"Maintainable at scale" isn't a slogan — it's a contract laid down one type signature at a time."

04

Why TS : WhyTS

Types aren't a cage — they're a tool. You sign a contract with your future self the moment you write the code.

Inference, not ceremony

Most variables don't need annotations; the compiler infers from context. You write code that looks like JS and get the protection of TS — small cost, big payoff.

const name = "Anders";
// hover: const name: string

Editor superpowers

Go-to-definition, find-references, rename refactors, method autocompletes — the things that are semi-magic in JS work concretely in TS, driven by types. VS Code itself is written in TS.

user.|
┌─ name : string
├─ age  : number
└─ email?: string

Sane at scale

Airbnb's 2019 retrospective: 38% of production bugs would have been caught by types. VS Code (1.5M lines of TS), Slack and Asana all walk this road.

// Change one prop, IDE
// flags all 47 call sites

Gradual migration

From a // @ts-check comment to a .ts file to strict mode — adopt file by file, no big-bang rewrite. Airbnb and Slack went exactly this way.

// @ts-check
// One line, JSDoc starts working

No ecosystem holes

The DefinitelyTyped repo carries 9,000+ @types/* packages — coverage for nearly every popular JS library. 85% of the npm top-1000 ship or have community types.

npm i -D @types/node
// Most libs need just one line

Types as docs

A signature tells callers exactly what to pass and what they get back. Comments can never beat a line like (input: User) => Promise<Order[]>.

function fetchOrders(
  user: User
): Promise<Order[]>

LLM-friendly

A 2025 study: 94% of LLM compilation failures are type-check errors — TS catches AI mistakes before they ship. Anders himself: "Static typing is the AI era's guardrail."

// LLM emitted: User.naem
// tsc errors instantly
// agent self-corrects on feedback

Clean output

Types disappear after tsc. Zero runtime cost — no VM, no runtime reflection. Production still runs plain JavaScript.

// input  user.ts
const x: number = 42;

// output user.js
const x = 42;

One contract, every layer

Shared schemas across backend / frontend / mobile. tRPC's end-to-end inference, Next.js / Nuxt server functions returning typed responses — no more drifting interface docs.

// shared/types.ts
export type Order = { ... };

// frontend / backend / mobile
// import the same type
05

Who's Using : ProductionUsers

IDEs, frameworks, enterprise codebases, and the hottest AI tools — TS is the de-facto JS-world standard. The 12 below carry roughly half the apps a developer opens on a given day.

06

TypeScript in the : AI Era

In the 2010s, writing TS was often mocked as trading JavaScript's nimbleness for type noise. The AI era flipped the wind — code-generating LLMs need a type system as a guardrail. This chapter is why TypeScript became the AI tool chain's native tongue.

"

An AI model is fundamentally a regurgitator at scale, with a bit of extrapolation. The more public code in a language, the better AI writes it. Strong type systems, reliable refactoring, accurate semantic models — these are the guardrails that let AI output be reviewed, verified and corrected, instead of trusted blindly. Static typing catches AI mistakes before they become production problems.

— Anders HejlsbergLead Architect, TypeScript · GitHub Blog · 2025
#1
GitHub's #1 language, 2025

GitHub Octoverse 2025: TS becomes GitHub's #1 language by contributors for the first time, past JavaScript and Python. Over a million new TS contributors that year, +66% YoY.

94%
of LLM compile errors are type errors

A 2025 academic study: when LLM-generated code fails to compile, the overwhelming majority of failures are type-check errors. Translation — TS is the last guardrail on LLM output.

20M+
Vercel AI SDK monthly downloads

Provider-agnostic TS toolkit unifying OpenAI / Anthropic / Google / xAI behind one API. Over 20M monthly downloads — the de-facto standard at the AI application layer on npm.

SPOTLIGHT

Claude Code Anthropic's official CLI

An agentic coding assistant that lives in your terminal, taking natural-language commands across git / editing / debug. Its source was reconstructed in March 2026 from a leaked source map — ~512,000 lines of TypeScript. Stack:

  • React + InkReact's declarative syntax, but for terminal UI
  • BunRuntime — faster cold start than Node, eats TS natively
  • main.tsx / commands.ts / tools.ts / Tool.ts / QueryEngine.tsModular agent architecture

In other words: this page is written in TypeScript, and so is the assistant that wrote it.

// Claude Code's Tool definition, roughly
interface Tool<Input, Output> {
  name: string;
  description: string;
  inputSchema: JsonSchema<Input>;
  handler: (input: Input) => Promise<Output>;
}

// Types fully describe a tool the LLM can call
// schema to the model, handler to the runtime
// TS keeps both sides in sync, always

AI tool chain · overwhelmingly TS

Claude Code
Anthropic terminal agent · TS
Cursor
AI-first IDE · TS / Electron
Continue
VS Code AI extension · TS
Aider
CLI coding assistant · partly TS
v0
Vercel UI generator · TS
Bolt.new
In-browser AI IDE · TS
Vercel AI SDK
AI app framework · TS-only
LangChain.js
LangChain, TS port
Mastra
Agent / workflow · TS
Genkit
Google AI framework · TS
TypeChat
Microsoft · TS types as prompt schema
Zod
Runtime schema validation · TS-first
@anthropic-ai/sdk
Official Anthropic TS SDK
@google/genai
Official Gemini TS SDK
openai (npm)
Official OpenAI TS SDK
MCP TypeScript SDK
Model Context Protocol · TS
REVERSE

TS types ↔ AI interface

AI tools being written in TS is only the surface. Deeper: TS types are becoming an AI interface language in their own right.

OpenAI / Anthropic "function calling," Google "structured output," MCP tool definitions — all need a schema. Write that schema as a TS interface, validate at runtime with zod / arktype, hand it to LLMs via zod-to-json-schema. One type, three consumers: compiler, runtime, model.

Microsoft's TypeChat goes further: drop a TS interface into the prompt as a template, force the model to output that shape, retry on violation. An end-to-end pipeline from natural language to typed JSON.

// 1. Describe the desired output in TS
const Order = z.object({
  customer: z.string(),
  items: z.array(z.object({
    sku: z.string(),
    qty: z.number().int().positive()
  })),
  total: z.number()
});

// 2. Pass schema to the LLM
const order = await generateObject({
  model: anthropic("claude-opus-4-7"),
  schema: Order,
  prompt: "User said: two cokes and a burger, please"
});

// 3. order is z.infer<typeof Order>
// Fully typed; auto-retry on schema violation

Summary, one line: AI isn't TypeScript's competitor — it's the strongest ally TS has ever had. The more pervasive LLMs become, the more the world needs machine-readable code contracts. The "extra typing" TS asked for in the 2010s turned out to be the key to working with AI in the 2020s.

07

vs JavaScript : JS vs TS

Not replacement — superposition. But the things you can do after stacking types on top differ by orders of magnitude.

JavaScriptTypeScript
Type checkingRuntime onlyCompile-time / live in IDE
null / undefinedBombs anywhereStripped from types under strict
RefactoringGrep + prayerType-driven, one-click rename
Enums / unionsString constants on the honor systemenum / 'a' | 'b' | 'c'
GenericsNone<T>, with constraints and inference
3rd-party typesRead docs / guess@types/* or built-in .d.ts
Build outputSource itselfPlain JS after compile, zero runtime cost
Learning curveEffectively zeroGradual — start with any, tighten later
Cost at scaleLinear + snowballing bugsSlightly higher up front, far lower after
AI collaborationHard to verify LLM outputTypes as guardrails; 94% of LLM errors are type errors
Cross-platform contractsSeparate interface docs per platformOne .d.ts shared across platforms
IDE experienceJSDoc-patched, half-brokenGo-to / autocomplete / rename — the full set
08

Outlook : TheRoadAhead

The compiler is going Go-native, runtimes are eating TS directly, and TC39 is trying to drag the syntax into the JS standard — three paths in motion at once.

HOT · 2025-03

Project Corsa / TypeScript 7

Anders Hejlsberg's team rewrites tsc in Go. The VS Code repo's type-check goes from 78s → 7.5s — Go's native compilation plus cross-module parallel type-checking. Microsoft calls it tsgo; it ships as TypeScript 7.0.

The deeper point: JS tooling has been bottlenecked by self-bootstrapping for years — the compiler written in JS, compiling itself. Switching to Go fixes the cold-start and memory issues in one stroke.

tsc (TS 5.x)78s
tsgo (TS 7)7.5s
TC39

Type Annotations proposal

Add a rule to JS engines: treat type annotations as comments. Browsers and Node could then directly run TS-flavored code.

Status: Stage 1 of 4. Slow, contested, unlikely to land soon.

RUNTIME

Runtimes that eat TS

Even without TC39, the major runtimes already work: Deno as first-class, Bun natively, Node.js 22+ with --experimental-strip-types. Once mainstream, the separate tsc step disappears.

DATA

78% of devs adopted

State of JS 2024: ~78% of respondents use TypeScript, more than half of them writing mostly TS rather than plain JS. Five years of straight growth.

FRAMEWORK

New frameworks default to TS

Next.js, Nuxt, SvelteKit, SolidStart, Astro, Remix — every create template defaults to .ts. NestJS is TS-only. The "should we use TS for new projects?" debate is over.

AI

AI era's inverse payoff

The "cost of types" used to fall on humans. With AI generating code, that cost shifts to the model — and humans move into reviewing / verifying / correcting. This amplifies the value of the type system: it gives humans a machine-readable guardrail.