Open-Source Wikis

/

TypeScript

/

TypeScript

microsoft/TypeScript

TypeScript

TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. This repository (microsoft/TypeScript) hosts the original JavaScript-based implementation of the TypeScript compiler (tsc), the standalone language server (tsserver), the bundled language service library, the standard library type declarations (lib.*.d.ts), and the test infrastructure that exercises them.

This wiki describes the codebase as it stands at the 6.0 release line. The repository is now in maintenance mode — TypeScript 6.0 is the last JavaScript-based release. Future development continues in the Go-based rewrite at microsoft/typescript-go. Bug fixes that do not meet the narrow 6.0 maintenance criteria should be sent there instead.

What's in this repository

The codebase is a single npm package, typescript, that ships several independently invocable executables and a programmatic API:

  • tsc — the command line compiler. Source: src/tsc/.
  • tsserver — the standalone language server hosted by editors (VS Code, Sublime, Vim plugins, etc.) over a JSON protocol. Source: src/tsserver/.
  • typescript API — the programmatic API surfaced by lib/typescript.js, exposing the compiler and language service to embedders. Source: src/typescript/.
  • typingsInstaller — the helper process that fetches @types/* packages on behalf of tsserver for automatic type acquisition. Source: src/typingsInstaller/.
  • watchGuard — a small launcher used by tsc --watch on Windows to recover from broken file watchers. Source: src/watchGuard/.
  • The standard library declarationslib.es5.d.ts, lib.dom.d.ts, and friends. Source: src/lib/.

How the compiler is structured

The compiler is organised as a sequence of phases. Source text becomes a token stream (the scanner), which is assembled into a syntax tree (the parser), then walked to populate symbol tables and control-flow graphs (the binder). A program of bound source files plus a host filesystem produces a Program, on which the checker answers type queries. The checker's output drives the transformers (which lower newer syntax into older targets) and finally the emitter, which prints JavaScript, declaration files, and source maps.

graph LR
    Source[".ts source"] --> Scanner
    Scanner --> Parser
    Parser --> Binder
    Binder --> Program
    Program --> Checker
    Checker --> Transformer
    Transformer --> Emitter
    Emitter --> Out[".js / .d.ts / .map"]

This pipeline is exercised both by tsc (one-shot or watch-mode compilation) and by tsserver (incremental, multi-project compilation in service of editor features). The same Program is also wrapped by the language service (src/services/) that produces completions, code fixes, refactorings, signature help, find-all-references, and the rest of the IDE feature set.

Where to start in this wiki

Maintenance status

The AGENTS.md file at the root of the repository spells out the repo's maintenance posture. Code changes are limited to crashes introduced in 5.9 or 6.0 that also reproduce in 7.0, security issues, language-service crashes that significantly impact mainline usage, serious 5.9 regressions, and non-disruptive lib.d.ts updates. New features, refactors, and general bug fixes belong in microsoft/typescript-go.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

TypeScript – TypeScript wiki | Factory