Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

typescript compile code with errors

I have a big js (es6) project which I started to migrate to typescript. First I changed all js files to ts. Then I executed tsc to compile the project. tsc outputs A-LOT of errors. I want to fix all of them but it'll take me some time. In this time I still want to project to be compiled as I know it works as expected.

Is there a way to compile while still having errors? I assume failed imports are a big problem and it'll stop but for sure none of this error exist currently in the project. I know I can disable checks with compiler option but I'm looking for a simpler way. Is there? :)

like image 787
Gal Ziv Avatar asked Apr 28 '26 22:04

Gal Ziv


1 Answers

The current version of TS does this by default - it emits .js code even if there's a non-serious error (e.g. type checking). Perhaps you need:

"noEmitOnError": false,`

tsc will now generate .js files even if there's a compiler error produced.

To disable this, i.e. the opposite of what you want we use:

"noEmitOnError": true,`
like image 170
Marc Avatar answered May 01 '26 20:05

Marc



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!