TypeScript Compiler Options

--stopBuildOnErrors — TypeScript build command

Skips building downstream projects when an upstream project has errors. In 5.8.3 build mode otherwise continues on a best-effort basis. This flag does not itself prevent erroneous upstream JavaScript emission; use noEmitOnError where needed. 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. Expect TS2322 and a nonzero exit; upstream output exists but downstream JavaScript and declarations do not.

Formal Syntax & Structure

typescript syntaxtypescript
tsc --build --stopBuildOnErrors

Parameters & Attributes

NameTypeDescription
stopBuildOnErrorsbooleanBuild-mode flag; default: false.

Working Example

Example Snippettypescript
// File: tsconfig.json (omit this label){  "files": [],  "references": [    {      "path": "./app"    },    {      "path": "./lib"    }  ]}// File: lib/tsconfig.json (omit this label){  "compilerOptions": {    "target": "ES2022",    "module": "CommonJS",    "strict": true,    "types": [],    "composite": true,    "rootDir": "src",    "outDir": "dist",    "tsBuildInfoFile": "dist/lib.tsbuildinfo"  },  "include": [    "src/**/*.ts"  ]}// File: lib/src/index.ts (omit this label)export const value: number = "bad";// File: app/tsconfig.json (omit this label){  "compilerOptions": {    "target": "ES2022",    "module": "CommonJS",    "strict": true,    "types": [],    "composite": true,    "rootDir": "src",    "outDir": "dist",    "tsBuildInfoFile": "dist/app.tsbuildinfo"  },  "include": [    "src/**/*.ts"  ],  "references": [    {      "path": "../lib"    }  ]}// File: app/src/index.ts (omit this label)import { value } from "../../lib/dist/index";console.log(value + 1);
// Run these commands in order in an isolated project:// tsc --build --stopBuildOnErrors --pretty false
TypeScript Reference