---
source: https://iinventedlight.com/library/notes/typescript-project-references.md
title: "TypeScript project references"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC BY 4.0 (microsoft/TypeScript-Website); prose restates cited source lines"
attribution: "Summary by iinventedlight (AI-assisted). Sources: TypeScript (Microsoft), TypeScript: Documentation - Project References, CC BY 4.0 (microsoft/TypeScript-Website); TypeScript (Microsoft), TypeScript: TSConfig Option: composite, CC BY 4.0 (microsoft/TypeScript-Website)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-04
as_of: 2026-11-04
confidence: medium
untested: "No code was run for this note; only the fetched documentation pages were read."
category: coding-references
topic_area: "code-ai-eng: TypeScript"
tags: ['typescript', 'tsconfig', 'monorepo', 'build']
sources:
  - id: S1
    title: "TypeScript: Documentation - Project References"
    publisher: TypeScript (Microsoft)
    url: https://www.typescriptlang.org/docs/handbook/project-references.html
    accessed: 2026-11-04
    license: "CC BY 4.0 (microsoft/TypeScript-Website)"
  - id: S2
    title: "TypeScript: TSConfig Option: composite"
    publisher: TypeScript (Microsoft)
    url: https://www.typescriptlang.org/tsconfig/composite.html
    accessed: 2026-11-04
    license: "CC BY 4.0 (microsoft/TypeScript-Website)"
---
# TypeScript project references

**Answer:** Project references (TypeScript 3.0+) split a codebase into smaller projects, each with its own tsconfig, that reference one another.

## Setup

```json
// packages/app/tsconfig.json
{
  "compilerOptions": { "outDir": "dist" },
  "references": [{ "path": "../core" }]
}

// packages/core/tsconfig.json
{ "compilerOptions": { "composite": true, "declaration": true, "outDir": "dist" } }
```

## composite

Referenced projects need `composite: true`. It enforces constraints so build tools can tell quickly whether a project is up to date:

- `declaration` must be on.
- All source files must be matched by `include` or `files`.
- `rootDir` defaults to the tsconfig's directory if not set.

## Build mode

```bash
tsc -b            # build everything needed
tsc -b --watch
tsc -b --clean
```

Build mode automatically builds referenced projects when needed.

## Claims
- id: C1
  claim: Project references structure programs into smaller pieces, in TypeScript 3.0+.
  source: S1
  evidence: "Project references allows you to structure your TypeScript programs into smaller pieces, available in TypeScript"
- id: C2
  claim: tsc --build (tsc -b for short) is build mode.
  source: S1
  evidence: "Running tsc --build (tsc -b for short) will do the following:"
- id: C3
  claim: Build mode automatically builds referenced projects if needed.
  source: S1
  evidence: "Build mode (see below) will automatically build the referenced project if needed"
- id: C4
  claim: composite enforces constraints for build tools.
  source: S2
  evidence: "The composite option enforces certain constraints which make it possible for build tools"
- id: C5
  claim: rootDir defaults to the directory containing tsconfig.json.
  source: S2
  evidence: "The rootDir setting, if not explicitly set, defaults to the directory containing the tsconfig.json file."

## Sources
- [S1] TypeScript: Documentation - Project References. TypeScript (Microsoft). https://www.typescriptlang.org/docs/handbook/project-references.html . License: CC BY 4.0 (microsoft/TypeScript-Website). Accessed 2026-11-04.
- [S2] TypeScript: TSConfig Option: composite. TypeScript (Microsoft). https://www.typescriptlang.org/tsconfig/composite.html . License: CC BY 4.0 (microsoft/TypeScript-Website). Accessed 2026-11-04.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
