TypeScript Compiler Options
extends — TypeScript project configuration
Inherits a base configuration; relative paths resolve relative to the config where they originate. Child compiler options override base options and child files/include/exclude replace inherited lists rather than merging. References are not inherited. With multiple bases, later bases override earlier ones before the child. Circular inheritance is invalid. Baseline: TypeScript 5.8.3. Default: none. Example: create the labeled files in an isolated project and run the commands in order. See companion fixtures for comparison cases and expected results. ShowConfig reports strict and noEmit enabled and index.ts as the root; compilation emits no JavaScript.
Formal Syntax & Structure
typescript syntaxtypescript
{ "extends": "./base.json"}Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| extends | string or string[] | Top-level TSConfig property; default: none. |
Working Example
Example Snippettypescript
// File: base.json (omit this label){ "compilerOptions": { "target": "ES2022", "module": "CommonJS", "strict": false, "types": [], "noEmit": true }, "include": [ "old.ts" ]}// File: tsconfig.json (omit this label){ "extends": "./base.json", "compilerOptions": { "strict": true }, "include": [ "index.ts" ]}// File: old.ts (omit this label)const bad: number = "x";// File: index.ts (omit this label)export const value = 7;
// Run these commands in order in an isolated project:// tsc -p . --showConfig// tsc -p . --pretty false