TypeScript Compiler Options

composite — TypeScript project configuration

Enables constraints for referenced projects: declaration output defaults on, rootDir defaults to the config directory and implementation inputs must be listed or included. A referencing project requires the referenced project to be composite. Baseline: TypeScript 5.8.3. Default: false. Example: create the labeled files in an isolated project and run the commands in order. See companion fixtures for comparison cases and expected results. The output contains index.js, index.d.ts and tsconfig.tsbuildinfo inside dist.

Formal Syntax & Structure

typescript syntaxtypescript
{  "compilerOptions": {    "composite": true  }}

Parameters & Attributes

NameTypeDescription
compositebooleanCompiler option; default: false.

Working Example

Example Snippettypescript
// File: tsconfig.json (omit this label){  "compilerOptions": {    "target": "ES2022",    "module": "CommonJS",    "strict": true,    "types": [],    "composite": true,    "outDir": "dist"  },  "files": [    "index.ts"  ]}// File: index.ts (omit this label)export const value: number = 7;
// Run these commands in order in an isolated project:// tsc -p . --pretty false
TypeScript Reference