[TypeScript] Stopping a TypeScript Build When Errors Are Found

时间:2023-03-10 06:04:50
[TypeScript] Stopping a TypeScript Build When Errors Are Found

TypeScript will always compile even if there are ridiculous errors in your project. This lesson shows how to configure your .tsconfig with "noEmitOnError" so that no files are output if tsc reports an error.

 tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"sourceMap": false,
"outDir": "./dist",
"noEmitOnError": true
},
"files": [
"main.ts"
]
}