This document explains how to contribute code changes to the TypeScript compiler and language service codebase. It covers setting up your development environment, the build and test workflow, writing tests, managing baselines, and submitting pull requests. For information about reporting issues, see Issue Reporting. For details about the build system itself, see Build System. For testing infrastructure details, see Test Infrastructure.
Important: Development in this codebase is winding down per CONTRIBUTING.md5 All code changes should be submitted to the https://github.com/microsoft/typescript-go repository. PRs to this repo will only be merged for critical 6.0 issues, such as security issues or serious regressions README.md31-38
Before contributing, you need the following installed on your machine:
| Tool | Purpose | Installation |
|---|---|---|
| Node.js | JavaScript runtime (>=14.17) | package.json29 Download from https://nodejs.org |
| Git | Version control | Standard installation |
| hereby | Task runner for building and testing | npm install -g hereby CONTRIBUTING.md87 |
| Editor | Code editing (VS Code recommended) | https://code.visualstudio.com |
Additional requirements:
For Windows users, enable long path support before cloning:
To avoid line ending issues, configure Git:
Sources: CONTRIBUTING.md109-111 CONTRIBUTING.md148 package.json29-30
Sources: CONTRIBUTING.md89-107 package.json100-101
The hereby command-line tool, defined in Herebyfile.mjs9 orchestrates all build and test operations. Common tasks:
| Command | Purpose |
|---|---|
hereby local | Build compiler to built/local/ Herebyfile.mjs246 |
hereby clean | Delete build artifacts Herebyfile.mjs518 |
hereby LKG | Update Last Known Good compiler in lib/ Herebyfile.mjs540 |
hereby tests | Build test infrastructure Herebyfile.mjs410 |
hereby runtests | Run tests with built compiler Herebyfile.mjs421 |
hereby runtests-parallel | Run tests across multiple threads Herebyfile.mjs433 |
hereby baseline-accept | Accept baseline test results Herebyfile.mjs478 |
hereby lint | Run ESLint on TypeScript source Herebyfile.mjs491 |
Sources: Herebyfile.mjs45-550 package.json88-101
Sources: CONTRIBUTING.md113-115 package.json91-101 Herebyfile.mjs421-489
Tests are categorized by their target functionality:
| Directory | Purpose |
|---|---|
tests/cases/compiler/ | General compiler tests |
tests/cases/conformance/ | Language specification compliance tests |
tests/cases/fourslash/ | Language service (IDE) tests |
tests/cases/projects/ | Multi-file project build tests |
Sources: CONTRIBUTING.md216-227
For details on test case structure and syntax, see Writing Tests.
.ts file in the appropriate directory.--tests flag:
Sources: CONTRIBUTING.md216-228 scripts/build/tests.mjs36
TypeScript uses a "baseline" system where compiler output is compared against reference files.
| Baseline Type | Location | Content |
|---|---|---|
| Local | tests/baselines/local/ | Output from the current run scripts/build/tests.mjs22 |
| Reference | tests/baselines/reference/ | Known good output scripts/build/tests.mjs23 |
Sources: CONTRIBUTING.md244-270 scripts/build/tests.mjs22-23 Herebyfile.mjs478-489
Before submitting a Pull Request (PR):
hereby runtests-parallel passes locally package.json89For the complete PR lifecycle and review expectations, see Pull Request Process.
Sources: CONTRIBUTING.md7-17 CONTRIBUTING.md138-153
Sources: CONTRIBUTING.md1-277 package.json1-117
Refresh this wiki