TypeScript Compiler Options

excludeFiles — TypeScript watch configuration

Excludes selected files from watch registration. This does not exclude them from initial type checking or prevent an import from referencing them. Use carefully because skipped notifications may leave stale results. The example verifies initial diagnostics and parsing, not absence of notifications. Baseline: TypeScript 5.8.3. Default: unset. Create the labeled files in an isolated project; omit file labels. Run the indicated command.

Formal Syntax & Structure

typescript syntaxtypescript
{  "watchOptions": {    "excludeFiles": [      "src/generated.ts"    ]  }}

Parameters & Attributes

NameTypeDescription
excludeFilesstring[]Watch option; default: unset.

Working Example

Example Snippettypescript
// File: tsconfig.json (omit this label){  "compilerOptions": {    "target": "ES2022",    "module": "CommonJS",    "strict": true,    "types": [],    "noEmit": true  },  "include": [    "src/**/*.ts"  ],  "watchOptions": {    "excludeFiles": [      "src/generated.ts"    ]  }}// File: src/index.ts (omit this label)export const count: number = 1;// File: src/generated.ts (omit this label)export const bad: number = "x";
// Run in a temporary project:// tsc -p . --pretty false
TypeScript Reference