跳到主要内容
On this page

ReferencesThe Type System

TypeScript

JavaScript with types — and, since 7.0, a native compiler.

TypeScript at a glance

Role
The Type System
Domain
Web & Interface
Status
v7.0.2
What it does
  • Structural typing — shapes, not names, so the type follows the data.
  • Inference from context, so the common case needs no annotation at all.
  • Declaration files, so a library can ship its own types.
  • Gradual adoption — a `.js` file can be renamed `.ts` one at a time.
  • A native compiler — TypeScript 7 is a Go port, roughly ten times faster.

What it is

The point of a type system is not to describe what the code does. It is to make the set of things the code can do explicit, so a mistake is caught by a program that never runs the code at all.

TypeScript does that without asking you to change how JavaScript works. Types are erased at compile time, the output is ordinary JavaScript, and every tool that already understands JavaScript still understands the result.

How it works

The compiler walks the program, assigns a type to every expression, and reports the ones that cannot be reconciled. Because the type system is structural, two types match when their shapes match — which is why a plain object literal is often accepted where a class instance was expected, and why an interface is a description rather than a constructor.

  • TypeScript 6.0 was released in March 2026, and TypeScript 7.0 followed in July — a native Go port, roughly ten times faster on large projects.
  • TypeScript 7.0.2 is the current release; 7.1 is in beta.
  • Declaration files (`.d.ts`) let a library publish its own types, so consumers get the same checking without writing anything.

Under the hood

PieceWhat it is
Current release7.0.2 — released August 20, 2026
7.0The native Go port, announced July 8, 2026 — about 10x faster
Compiler outputPlain JavaScript; the types are erased
Type systemStructural — types match on shape, not on name
AdoptionGradual — check one file at a time

Where to read more