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/.typescriptAPI — the programmatic API surfaced bylib/typescript.js, exposing the compiler and language service to embedders. Source:src/typescript/.typingsInstaller— the helper process that fetches@types/*packages on behalf oftsserverfor automatic type acquisition. Source:src/typingsInstaller/.watchGuard— a small launcher used bytsc --watchon Windows to recover from broken file watchers. Source:src/watchGuard/.- The standard library declarations —
lib.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
- New to the codebase? Read overview/architecture and then systems/program, systems/parser, and systems/checker.
- Building locally? See overview/getting-started and how-to-contribute/development-workflow.
- Writing a test? See how-to-contribute/testing.
- Looking for a specific term? Check overview/glossary.
- Looking for the language-service surface? See systems/language-service and features/language-service-features.
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.