TypeScript
Last reviewed
May 4, 2026
Sources
15 citations
Review status
Source-backed
Revision
v1 ยท 4,079 words
Improve this article
Add missing citations, update stale details, or suggest a clearer explanation.
Last reviewed
May 4, 2026
Sources
15 citations
Review status
Source-backed
Revision
v1 ยท 4,079 words
Add missing citations, update stale details, or suggest a clearer explanation.
TypeScript is an open-source, statically typed programming language developed by Microsoft that extends JavaScript by adding optional static type annotations, interfaces, generics, and other features oriented toward large-scale application development. It compiles to plain JavaScript and runs anywhere JavaScript runs, including web browsers, Node.js, Deno, Bun, and serverless edge runtimes.
First released publicly on October 1, 2012, TypeScript was designed by Anders Hejlsberg, the architect of C# and the original author of Turbo Pascal and Delphi. The language is positioned as a strict syntactical superset of JavaScript: every valid JavaScript program is also a valid TypeScript program, and the additional type-checking is fully erased during compilation. Over its first decade, TypeScript moved from a niche Microsoft project to one of the most widely adopted languages on GitHub and Stack Overflow, and it became the default authoring language for many of the most popular frontend and backend frameworks, including Angular, Next.js, and Deno.
In the artificial intelligence ecosystem, TypeScript occupies a distinctive position. Most frontier AI laboratories ship a TypeScript SDK alongside their Python SDK, and the dominant production stack for consumer-facing AI applications, Next.js plus the Vercel AI SDK deployed on Vercel, is built around TypeScript. The reference implementations of the Model Context Protocol from Anthropic, the official Anthropic and OpenAI client libraries, and AI coding agents such as GitHub Copilot, Cursor, and Claude Code are all written in or rely heavily on TypeScript. As a result, TypeScript has become a primary language for both the consumers of large language model APIs and for the developer-tooling agents that produce code with them.
| Field | Value |
|---|---|
| Designed by | Anders Hejlsberg, Microsoft |
| Developer | Microsoft and open-source contributors |
| First appeared | October 1, 2012 |
| Stable release | TypeScript 6.0 (March 23, 2026) |
| Preview release | TypeScript 7.0 Beta (April 2026, native Go-based compiler) |
| Typing discipline | Static, structural, gradual, optional |
| File extensions | .ts, .tsx, .mts, .cts, .d.ts |
| Influenced by | JavaScript, C#, Java, F#, ActionScript |
| License | Apache License 2.0 |
| Implementation language | TypeScript (5.x and 6.x compiler), Go (7.x native compiler) |
| Website | typescriptlang.org |
Work on TypeScript began inside Microsoft around 2010 in response to growing pressure from teams building increasingly complex JavaScript applications. Internal Microsoft products such as Bing, the Office web apps, and Visual Studio Online were running into the limits of plain JavaScript at scale. Refactoring large code bases without static types, navigating call graphs across thousands of files, and onboarding new engineers to a dynamically typed language were all consistently cited as pain points. Microsoft assigned Anders Hejlsberg, already a Technical Fellow and the lead architect of C#, to head a small team that would design a new language to address these problems while remaining strictly compatible with JavaScript.
Hejlsberg brought to the project a long history of programming language work. He had written the original Turbo Pascal compiler at Borland in the 1980s, served as the chief architect of Delphi in the 1990s, and led the design of C# at Microsoft starting in 1999. The team also included Luke Hoban, who became one of the co-designers of the early language, along with engineers from the Visual Studio and Microsoft Research divisions.
TypeScript 0.8 was unveiled publicly on October 1, 2012, after roughly two years of internal development. The initial release shipped with a command-line compiler written in TypeScript itself, a Visual Studio plug-in, and a small standard library of type definitions for the browser DOM. Reactions were mixed: Miguel de Icaza praised the language design but criticized the lack of editor support outside Visual Studio, a complaint that would shape Microsoft's later decision to invest heavily in cross-editor language tooling.
Version 0.9 followed in June 2013, introducing generics. TypeScript 1.0 shipped on April 2, 2014, alongside the Visual Studio 2013 Spring Update, marking the language as production-ready. The 1.x series added union types, type guards, and JSX support, the last of which proved decisive for adoption among React developers when Facebook's library began to dominate the frontend landscape.
TypeScript 2.0 was released on September 22, 2016. Its headline feature, the strictNullChecks compiler option, separated null and undefined from other types and forced developers to handle absent values explicitly. The change was inspired by the null-safety work in Kotlin, Swift, and academic languages such as Eiffel, and it eliminated entire classes of runtime errors at compile time. Around this period, Google's Angular team announced that the second-generation Angular framework would be written in TypeScript, lending the language significant credibility outside the Microsoft ecosystem.
TypeScript 3.0 arrived on July 30, 2018, introducing tuple rest parameters and project references for managing large monorepos. Version 4.0, released on August 20, 2020, added variadic tuple types and labeled tuple elements. TypeScript 5.0 shipped on March 16, 2023; it added the new TC39 standard decorators proposal and significantly reduced compiler size and startup time by replacing the legacy namespace-based module structure of the compiler internals with ECMAScript modules. The 5.x line continued through 5.9 with iterative improvements to inference, performance, and tooling integration.
On March 11, 2025, Anders Hejlsberg announced that Microsoft was porting the TypeScript compiler and language service to native code, written in Go. The project, internally code-named "Project Corsa," had been prototyped in several languages before the team settled on Go for its combination of garbage collection, structural typing, and ergonomic concurrency primitives. The choice surprised many observers who had expected Rust or C#, and Microsoft engineers fielded extensive questions about why the company's own language was passed over. Hejlsberg's stated reasons centered on the relative ease of porting the existing compiler architecture to Go without rewriting fundamental data structures.
The announcement promised an approximately 10 times improvement in compile times and editor responsiveness, with real-world benchmarks reported between 9.1 and 13.5 times faster across large open-source code bases. The native compiler ships under the package name @typescript/native-preview, with the binary called tsgo to distinguish it from the existing tsc. Microsoft positioned the native implementation as the basis of TypeScript 7.0, while continuing the JavaScript-based codebase as the 6.x line for compatibility. TypeScript 6.0 shipped on March 23, 2026, as the final major release of the JavaScript-based compiler, and TypeScript 7.0 Beta followed in April 2026 with the native Go-based foundation enabled by default in Visual Studio 2026.
The central design idea of TypeScript is gradual typing layered over JavaScript. Type annotations are optional, can be added incrementally, and have no runtime representation: the TypeScript compiler emits plain JavaScript with all type information stripped. Developers can mix typed and untyped code freely, which makes incremental migration of existing JavaScript code bases practical.
function greet(name: string, age?: number): string {
return age ? `Hello, ${name} (age ${age})` : `Hello, ${name}`;
}
TypeScript performs flow-sensitive type inference. The compiler infers the types of variables, function return values, and many expressions without explicit annotation. This keeps source code close in appearance to ordinary JavaScript while still providing the safety of static checking.
Interfaces describe the shape of objects and can be extended or merged. Type aliases provide a more general mechanism for naming any type, including unions, intersections, and computed types.
interface User {
id: string;
email: string;
createdAt: Date;
}
type Status = "active" | "suspended" | "deleted";
Generics allow functions, classes, and types to be parameterized over other types. They are essential for collection types, async wrappers, and typed builders, and they enable libraries to express constraints between input and output types.
function identity<T>(value: T): T {
return value;
}
class Repository<T extends { id: string }> {
find(id: string): Promise<T | null> { /* ... */ }
}
Union types (A | B) express that a value may be of one of several types; intersection types (A & B) combine multiple types into one. Together with narrowing operations such as typeof, instanceof, and in, they form the basis of TypeScript's discriminated union pattern.
A discriminated union is a union of object types that share a common literal property used to distinguish cases. This pattern, sometimes called a tagged union or sum type, is widely used to model events, network responses, and state machines.
type Result<T> =
| { kind: "ok"; value: T }
| { kind: "error"; error: Error };
Conditional types (T extends U ? X : Y) and mapped types (with the keyof and in operators) allow developers to express transformations over types. Combined with infer, they make TypeScript's type system effectively a pure functional language at the type level, capable of expressing patterns such as deep readonly, function parameter extraction, and JSON schema validators.
TypeScript pioneered an experimental decorator syntax that influenced the TC39 proposal. Since version 5.0, TypeScript supports the standard decorators proposal at TC39 stage 3, which differs from the original experimental design and is used by frameworks such as Angular and NestJS.
TypeScript supports ECMAScript modules (ESM) and CommonJS, with explicit configuration controlling how imports are resolved and emitted. The .mts and .cts file extensions force a file to be treated as ESM or CommonJS respectively, and corresponding .d.mts and .d.cts declaration files allow library authors to publish dual-format packages.
Files with the .tsx extension allow JSX syntax. The compiler can emit either React-compatible function calls (jsx and jsxs from react/jsx-runtime), classic React.createElement output, or preserved JSX for downstream tooling. JSX support made TypeScript the default authoring language for modern React and Next.js development.
A project's behavior is controlled by tsconfig.json, which exposes hundreds of compiler options. Common settings include strict, which turns on the recommended set of safety checks; target and lib, which select the JavaScript output level and standard library; module and moduleResolution, which control module emit and resolution; and paths, which configures aliasing for monorepos and bundlers.
The primary TypeScript compiler is tsc, distributed via the typescript package on npm. It performs three main tasks: parsing TypeScript source into an abstract syntax tree, performing type checking and inference, and emitting JavaScript along with optional .d.ts declaration files and source maps. From version 7.0 onward, the native tsgo binary becomes the recommended compiler, while tsc remains available for compatibility.
A significant portion of TypeScript's value lies in its language service, an in-process API that provides editors with completions, signature help, hover information, refactoring, and diagnostic reporting. The language service powers IntelliSense in VSCode, which Microsoft developed in TypeScript and which dogfoods the language service to provide its JavaScript and TypeScript editing experience. Other editors, including Vim, Emacs, JetBrains IDEs, and Zed, communicate with the language service through the Language Server Protocol or direct integration.
Because types are erased at compile time, TypeScript supports import type and export type syntax that is guaranteed not to produce runtime imports. This is essential for build pipelines that strip types without performing full compilation.
Many modern build tools, including esbuild, swc, Babel, and Bun's built-in transpiler, support TypeScript by stripping type annotations and emitting JavaScript without performing type checking. Type checking is then run separately, often in CI, by invoking tsc --noEmit. This split between fast type-stripping for development and slower full type-checking for verification became the standard pattern after esbuild and swc demonstrated dramatically faster build times than tsc alone. Node.js 22 and 23 added experimental support for running TypeScript files directly with type-stripping, and Deno and Bun support TypeScript natively without an explicit build step.
TypeScript is among the most widely used programming languages by every major industry survey. The Stack Overflow Developer Survey has consistently placed TypeScript in the top five most-used languages since 2020, and in 2024 it ranked third behind JavaScript and Python. The annual GitHub Octoverse report has shown TypeScript growing every year, and it overtook Java in 2024 to become the third most popular language on GitHub by repository count. JetBrains' State of the Developer Ecosystem similarly reports TypeScript as among the most loved and most used languages year over year.
TypeScript is the primary language for frontend development at many large organizations. Microsoft uses TypeScript across Office, Teams, Azure, and Visual Studio Code itself. Google adopted TypeScript as a permitted language internally in 2017 and ships Angular, Material Design Components, and large parts of Firebase in TypeScript. Airbnb, Slack, Asana, Stripe, Vercel, Shopify, and Discord all use TypeScript for substantial portions of their stacks. Anthropic uses TypeScript across its developer tooling, including Claude Code and the @anthropic-ai/sdk client library.
The TypeScript ecosystem spans frontend, backend, database, and validation layers. The following table lists representative projects in each category:
| Area | Notable TypeScript-first or TypeScript-heavy projects |
|---|---|
| Frontend frameworks | React, Next.js, Angular (TypeScript-first since 2.0), Vue 3, Svelte, Solid, Remix, Astro, Qwik |
| Server runtimes | Node.js (with type-stripping), Deno (native TypeScript), Bun (native TypeScript) |
| Backend frameworks | Express with @types/express, Fastify, NestJS, Hono, Elysia, Encore.ts |
| Databases and ORMs | Prisma, Drizzle ORM, TypeORM, MikroORM, Kysely |
| Validation and parsing | Zod, Valibot, Yup, ArkType, io-ts |
| State management | Redux Toolkit, Zustand, Jotai, XState, TanStack Query |
| Build tools | Vite, Turbopack, esbuild, swc, Rspack, tsup, Rollup |
| Testing | Vitest, Jest with ts-jest, Playwright |
| Monorepo tools | Turborepo, Nx, pnpm workspaces |
Angular is notable as the first major framework to be written in TypeScript from the ground up, beginning with version 2.0 in 2016. Vue 3 was rewritten in TypeScript for the same reason: the maintainers wanted better tooling and a single source of truth for types exposed to user code. Deno, created by Node.js's original author Ryan Dahl, ships with a TypeScript runtime built in and treats TypeScript as a first-class input language alongside JavaScript and WebAssembly. Bun likewise transpiles TypeScript natively without a build step.
TypeScript has become a primary language for building applications that use large language models, and for the agents that build software with them.
The major model providers all publish official TypeScript SDKs alongside their Python equivalents. The openai package on npm is the OpenAI official SDK, the @anthropic-ai/sdk package is Anthropic's official client, and Google publishes @google/generative-ai for the Gemini family of models. These SDKs typically expose strongly typed request and response objects, generator-based streaming APIs, and helpers for tool use and structured output. The Anthropic and OpenAI TypeScript SDKs are open source and developed in the open on GitHub, with type definitions automatically generated from the providers' OpenAPI specifications.
The Vercel AI SDK, distributed as the ai package on npm, is a TypeScript-first toolkit for building streaming chat, completion, agentic, and generative-UI features in web applications. It provides a uniform API across providers, hooks for React, Vue, and Svelte, and helpers for tool use, structured output, retrieval augmentation, and image and audio generation. The combination of Next.js, the Vercel AI SDK, and Vercel's edge platform has emerged as the de facto deployment pattern for production AI applications, particularly those that require real-time streaming and integration with other web technologies.
LangChain.js and LlamaIndex.TS provide TypeScript implementations of the popular Python frameworks. Both began as ports and have grown to include additional features specific to JavaScript runtimes, such as streaming-first APIs and Edge runtime compatibility. Mastra, Genkit, and Agno also offer TypeScript-first agent frameworks.
A distinctive feature of the current generation of AI coding tools is that most are themselves written in TypeScript and produce TypeScript output of unusually high quality. GitHub Copilot's VSCode extension is written in TypeScript, Cursor and Windsurf are forks of VSCode and therefore TypeScript-based, Claude Code is Anthropic's TypeScript command-line agent distributed via npm, and v0 from Vercel generates TypeScript and React code as its primary output. The result is a feedback loop in which the most-used AI coding tools are written in TypeScript, training data heavily reflects TypeScript code, and frontier models therefore tend to produce TypeScript output that is more idiomatic and better-typed than their output in some other languages.
The Model Context Protocol (MCP), introduced by Anthropic in November 2024, is an open standard for connecting AI assistants to data sources, tools, and services. Anthropic published reference servers and the official MCP SDK in TypeScript, and the broader MCP ecosystem of third-party servers is predominantly TypeScript. The protocol's emphasis on streaming and message passing aligns naturally with Node.js and the runtimes built on it.
Serverless AI applications often run in JavaScript-first edge environments, including Vercel's Edge Functions, Cloudflare Workers, and Deno Deploy. These runtimes are designed around the JavaScript event loop and the V8 isolate model, and they treat TypeScript as a first-class authoring format. For inference workloads that run in the browser, libraries such as transformers.js and ONNX Runtime Web ship typed APIs and integrate with WebAssembly for hardware-accelerated execution. The combination of TypeScript on the server, WebAssembly for performance, and JavaScript-compatible inference libraries provides a path for shipping AI features that do not depend on a Python backend.
TypeScript is a superset of JavaScript: any valid JavaScript program is a valid TypeScript program, and TypeScript compiles to JavaScript. The differences lie in the development experience, the build pipeline, and the runtime guarantees. The following table summarizes the contrast:
| Aspect | JavaScript | TypeScript |
|---|---|---|
| Typing | Dynamic, weakly typed | Static, structural, gradual |
| Type checking | At runtime, only when an operation fails | At compile time, before code runs |
| Build step | Optional (browsers and Node run JS directly) | Usually required (tsc, esbuild, swc) or stripped at runtime by Deno, Bun, Node 23+ |
| Editor tooling | Limited completions, fuzzy go-to-definition | Rich completions, accurate go-to-definition, automated refactoring |
| Learning curve | Low for newcomers | Higher: types, generics, configuration |
| Runtime overhead | None beyond JavaScript itself | None: types are erased at compile time |
| Standardization | ECMAScript standard (TC39) | Microsoft-controlled, no formal standard |
| Suitability for small scripts | Excellent | Often heavyweight |
| Suitability for large code bases | Difficult to maintain | Designed for it |
| Tooling for refactoring | Manual or text-based | Type-aware: automated rename, extract, change signature |
TypeScript's design choices have invited several persistent criticisms. The most common is the requirement for a build step. Although Deno, Bun, and recent Node.js versions can strip types at runtime, most TypeScript projects still rely on a separate compilation or transpilation pass, which adds complexity to development workflows and slows down iteration on very large code bases. The native compiler port to Go, which targets a roughly tenfold improvement in compile time, was driven in significant part by complaints from teams whose tsc invocations had grown into multi-minute operations.
A second criticism is that TypeScript types are erased at runtime. The compiler provides no runtime type information by default, which means that data crossing trust boundaries (HTTP request bodies, environment variables, file contents, LLM responses) must be validated separately. Libraries such as Zod, Valibot, ArkType, and io-ts fill this gap by providing runtime schemas that produce TypeScript types and parse incoming data in a single declaration. Still, developers regularly write code that trusts a TypeScript annotation as if it were a runtime guarantee, leading to bugs that pure type checking cannot catch.
A third concern centers on structural typing, which sometimes accepts values that the developer did not intend. Two unrelated interfaces with the same shape are considered compatible, and excess property checks apply only in narrow circumstances. This contrasts with nominal type systems in languages such as Java or C#, where unrelated types are never compatible even if they have the same fields.
Fourth, the type system is undecidable in the general case. Sufficiently complex conditional and mapped types can produce compilation errors, infinite recursion, or hangs in the type checker. Library authors who write advanced types (for example, type-level URL parsers, SQL query builders, or schema-to-type converters) sometimes need to bound the recursion explicitly to keep the compiler tractable.
Finally, TypeScript is controlled by Microsoft rather than being part of the ECMAScript standard. Although the language is open source under the Apache 2.0 license and developed publicly on GitHub, language design decisions ultimately rest with Microsoft. A 2022 proposal to bring a small subset of TypeScript-style type annotations into the ECMAScript standard, championed by Microsoft staff, has progressed slowly through TC39, and as of 2026 there is no consensus on standardization.
The following table lists major TypeScript releases and their headline features. Many minor releases (5.1, 5.2, and so on) included substantial improvements that are not summarized here.
| Version | Release date | Headline features |
|---|---|---|
| 0.8 | October 1, 2012 | Initial public release |
| 0.9 | June 18, 2013 | Generics, declaration merging |
| 1.0 | April 2, 2014 | First stable release, shipped with Visual Studio 2013 Spring Update |
| 1.4 | January 2015 | Union types, type aliases, let and const |
| 1.5 | July 2015 | ES6 modules, namespace keyword, decorators (experimental) |
| 1.6 | September 2015 | JSX support, intersection types, abstract classes |
| 1.8 | February 2016 | Allow JavaScript files in TypeScript projects, string literal types |
| 2.0 | September 22, 2016 | Strict null checks, control flow analysis, never type |
| 2.1 | December 2016 | Mapped types, keyof, async functions for ES5 targets |
| 2.4 | June 2017 | String literal enums, weak types |
| 3.0 | July 30, 2018 | Project references, tuples in rest and spread, unknown type |
| 3.7 | November 2019 | Optional chaining (?.), nullish coalescing (??), assertion functions |
| 4.0 | August 20, 2020 | Variadic tuple types, labeled tuple elements, class field inference |
| 4.5 | November 2021 | .mts and .cts file extensions, awaited type, template string narrowing |
| 4.9 | November 2022 | satisfies operator, accessor keyword |
| 5.0 | March 16, 2023 | Standard decorators (TC39), const type parameters, smaller package size |
| 5.4 | March 2024 | NoInfer utility type, preserving narrowing in closures |
| 5.5 | July 2024 | Inferred type predicates, regular expression syntax checking |
| 5.6 | September 2024 | Disallowed nullish and truthy checks, region-prioritized diagnostics |
| 5.7 | November 2024 | Path rewriting for relative paths, never-initialized variable checks |
| 5.8 | February 2025 | Granular checks for branches in returns, --module nodenext support |
| 5.9 | 2025 | Final iterative release of the 5.x line |
| 6.0 | March 23, 2026 | Final JavaScript-based release, ES2025 lib, Temporal types, RegExp.escape |
| 7.0 (Beta) | April 2026 | Native Go-based compiler, approximately 10x faster builds |