TypeScript

TypeScript is a free, open-source programming language from Microsoft that adds static types to JavaScript. The compiler checks the code before it runs and turns it into plain JavaScript; the first public version appeared in October 2012.

Key facts

Type Programming language, typed superset of JavaScript
Developer Microsoft
Lead architect Anders Hejlsberg
First public release October 1, 2012 (version 0.8, preview)
Latest stable version TypeScript 7.0 (npm package 7.0.2), released July 8, 2026 (as of November 2026)
Next version TypeScript 7.1, in beta since October 20, 2026
Compiler tsc, written in Go since version 7.0
Output JavaScript
File extensions .ts, .tsx, .mts, .cts, .d.ts
License Apache 2.0
Website typescriptlang.org

History

Microsoft announced TypeScript on October 1, 2012, as an early preview of a language for “application-scale” JavaScript: a superset that adds type checking, interfaces and modules and compiles to standard JavaScript. Anders Hejlsberg, whose earlier work includes Turbo Pascal and C#, presented it. The compiler source was published on CodePlex under the Apache 2.0 license. Version 1.0 followed on April 2, 2014, and in July 2014 development moved to GitHub.

In March 2025, Hejlsberg announced a port of the compiler and language service to Go, codenamed Corsa (the original codebase is called Strada). TypeScript 6.0, released on March 23, 2026, was the last version built on the original JavaScript codebase and served as a bridge to the port. TypeScript 7.0, the native Go version, came out on July 8, 2026.

According to GitHub’s Octoverse report, in August 2025 TypeScript became the most used language on GitHub by monthly contributors, ahead of Python and JavaScript. The 2026 report says that order held.

What TypeScript is used for

  • Web front ends: GitHub notes that Next.js, Astro, SvelteKit, Angular, Remix and other frameworks generate a TypeScript codebase by default.
  • Servers and APIs: back ends on Node.js, Deno or Bun, where types describe requests, responses and database records.
  • Libraries: packages ship type declarations so that users get autocompletion and error checking.
  • Editor tooling: the TypeScript language service powers autocompletion, navigation and refactoring in editors such as Visual Studio Code.
  • AI-assisted coding: GitHub links TypeScript’s growth partly to typed languages making agent-written code easier to check.

How it works

Static types and inference

A developer annotates variables, function parameters and return values with types, or describes the shape of objects with interface and type. The compiler compares every use against these declarations and reports mismatches, such as a string passed where a number is expected or a misspelled property name. In many cases annotations are optional: TypeScript infers that let msg = "hello" is a string. Types are structural, so any object with the required properties fits an interface.

Compile time and runtime

Type checking happens before the program runs. When producing JavaScript, the compiler erases annotations, and the handbook stresses that type annotations never change the runtime behavior of a program. As a result, types do not exist at runtime: data from a network or a user still has to be validated in code. By default, tsc writes JavaScript output even when it reports errors; the noEmitOnError option prevents that.

tsc and tsconfig.json

tsc is the official compiler. A tsconfig.json file marks the root of a project and lists its files and compiler options: target JavaScript version, module system, strictness and output folder. tsc --init creates this file, tsc --noEmit only checks types, and tsc --watch rebuilds on changes.

Declaration files and DefinitelyTyped

Files with the .d.ts extension contain only type information and produce no JavaScript. TypeScript ships such files for standard JavaScript and browser APIs. Many npm packages include their own declarations; for others, the DefinitelyTyped repository publishes types under the @types scope, for example npm install --save-dev @types/node. The compiler finds them in node_modules/@types automatically.

Example

interface User {
  id: number;
  name: string;
  email?: string; // optional property
}

function greet(user: User): string {
  return `Hello, ${user.name}!`;
}

const aigerim = { id: 1, name: "Aigerim" }; // type is inferred
console.log(greet(aigerim)); // OK: the shape matches User

greet({ id: "2", name: "Daniyar" });
// error TS2322: Type 'string' is not assignable to type 'number'.

npx tsc --noEmit user.ts reports the error on the last call, where id is a string instead of a number, before the code ever runs. The first call needs no annotation on aigerim: TypeScript infers the type and checks that it matches User.

Running TypeScript today

  • tsc: checks types and emits JavaScript, which then runs in any browser or runtime.
  • Bundlers and transpilers: esbuild, swc and Babel convert TypeScript to JavaScript without checking types, so projects run tsc --noEmit as a separate step, for example in CI.
  • Node.js: type stripping has been on by default since 23.6.0 and 22.18.0 and stable since 25.2.0 and 24.12.0. Node.js replaces types with whitespace and does not check them; enums and namespaces with runtime code are not supported, and tsconfig.json is ignored.
  • Deno: runs .ts files natively; type errors do not stop execution unless --check is passed, and deno check works like tsc --noEmit.
  • Bun: its loader strips TypeScript syntax and does not check types.

TypeScript 7 and the 6.x line

As of November 2026, the current version is 7.0. Microsoft reports that full builds are typically 8–12 times faster than with 6.0; checking the VS Code codebase dropped from 125.7 to 10.6 seconds. Version 7.0 also changes defaults: strict is on, module is esnext and types is an empty list. Legacy options such as target: es5, AMD and UMD modules and baseUrl were removed.

TypeScript 7.0 has no programmatic API, so tools that embed the compiler, including editor support for Vue, Svelte, Astro and Angular templates, still rely on 6.0. It stays available as the @typescript/typescript6 package with a tsc6 command. TypeScript 7.1, in beta since October 20, 2026, adds a new API.

Pros and cons

Pros:

  • Many errors are caught while writing code rather than in production.
  • Autocompletion, navigation and safe renaming across large codebases.
  • Types document function contracts and API responses.
  • Gradual adoption: JavaScript files can be migrated one at a time.
  • Type definitions for thousands of libraries through DefinitelyTyped.
  • Open source under Apache 2.0; version 7.0 checks large projects much faster.

Cons:

  • An extra type-checking step and configuration to maintain.
  • Types disappear at runtime, so external data still needs validation.
  • Advanced generic and conditional types can be hard to read.
  • Typings maintained separately from a library can be incomplete or lag behind it.
  • Upgrading to 7.0 may require configuration changes, and some tools still need 6.0.

How to get started

  1. Try the language in the browser at the TypeScript Playground.
  2. Add TypeScript to a project and create a configuration:
npm install --save-dev typescript
npx tsc --init
npx tsc --noEmit
  1. For Node.js code, install @types/node and add "node" to types in tsconfig.json. Then read the TypeScript Handbook.

Sources

  1. TypeScript: JavaScript Development at Application Scale (October 1, 2012) — Microsoft (accessed 28 November 2026)
  2. A 10x Faster TypeScript — Microsoft TypeScript Blog (accessed 28 November 2026)
  3. Announcing TypeScript 6.0 — Microsoft TypeScript Blog (accessed 28 November 2026)
  4. Announcing TypeScript 7.0 — Microsoft TypeScript Blog (accessed 28 November 2026)
  5. TypeScript Handbook: Type Declarations — Microsoft (accessed 28 November 2026)
  6. Modules: TypeScript (Node.js v26 documentation) — OpenJS Foundation (accessed 28 November 2026)
  7. Octoverse: A new developer joins GitHub every second as AI leads TypeScript to #1 — GitHub (accessed 28 November 2026)
  8. Octoverse: Commits, pushes, reach new highs in 2026 as developers build with agents — GitHub (accessed 28 November 2026)

Also available in: Русский · Қазақша