Wednesday, May 5, 2021

how to fix Compiler option noEmitOnError not working with tsc in Typescript?

it is the best practice to use "noEmitOnError" option to prevent typescript compiler to generate the JavaScript file

however the config setting file does not work, when we execute the compiler command. such as the following

tsc myfile.ts 

the output is myfile.js. obviously the compiler did not pick the configuration from the config file. we have to run it expressively 

tsc --noEmitOnError myfile.ts

or force the compile to read from the tsconfig.json file

tsc -p ./tsconfig.json


No comments:

Post a Comment