TypeScript Compiler Options

preserveWatchOutput — TypeScript compiler configuration

Retains older console output instead of clearing it during watch compilations. Useful for comparing successive diagnostics or captured logs; it does not change diagnostic semantics. The example checks the absence of the terminal reset sequence with preservation enabled. Baseline: TypeScript 5.8.3. Default: false. Create the labeled files in an isolated project; omit file labels. Stop the ongoing watcher with Ctrl+C.

Formal Syntax & Structure

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

Parameters & Attributes

NameTypeDescription
preserveWatchOutputbooleanCompiler option; default: false.

Working Example

Example Snippettypescript
// File: tsconfig.json (omit this label){  "compilerOptions": {    "target": "ES2022",    "module": "CommonJS",    "strict": true,    "types": [],    "noEmit": true,    "preserveWatchOutput": true  },  "include": [    "src/**/*.ts"  ]}// File: src/index.ts (omit this label)export const count: number = 1;
// Run in a temporary project:// tsc -p . --watch --pretty false// After initial compilation, apply the following file change; stop watch with Ctrl+C.// Replace or create: src/index.tsexport const count: number = "bad";
TypeScript Reference