Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force TypeScript to not compile to JS when I have an error in ts code, with tsconfig file?

I didn't find in the default file: tsc --init

my config file

github code

{
  "compilerOptions" : {
      "target": "ES3",
      "module": "ES2015",
      "declaration": false,
      "sourceMap": true,
      "outDir": "./dist",
      "rootDir": "./src",
      
      "watch": true
  },
  
 
  "include": [
      "src/**/*"
  ]
} 
like image 432
Ali Dhuniya Avatar asked Oct 29 '25 20:10

Ali Dhuniya


1 Answers

You need to add noEmitOnError: true in your tsconfig.json.

This flag controls if the typescript compiler should generate output files if any errors were reported. And by default it is false, meaning the compiler will still emit output files even when there are errors.

https://www.typescriptlang.org/tsconfig#noEmitOnError

like image 199
Abito Prakash Avatar answered Nov 01 '25 10:11

Abito Prakash



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!