Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tsc - ignore errors at command line

I have this:

$ tsc -m amd --outFile dist/out.js lib/index.ts

lib/index.ts(87,48): error TS1005: ';' expected.

Is there a command line option I can use to ignore errors?

like image 991
Alexander Mills Avatar asked Jan 11 '18 05:01

Alexander Mills


2 Answers

With the // @ts-ignore comment, Typescript compiler will ignore the line below it.

For example, you got an compiling error here:

enter image description here

enter image description here

Then just add // @ts-ignore enter image description here

like image 115
Giang Nguyễn Avatar answered Sep 20 '22 13:09

Giang Nguyễn


No. There is no option to disable error Reports in TypeScript.

I just recently tried that, to improve my build pipeline. I checked the the TypeScript sources. It shouldn't be too complicated to code a flag to basically ignore all errors. But I didn't want to go through the whole PR/Approval Process for something that does the opposite of what typescript does. I found a different solution.

I also have a huge, converted code-base. There are other tools that transform TypeScript to JavaScript (but they lack Error Checking - which is what you want):

  1. sucrase https://github.com/alangpierce/sucrase
  2. @babel/preset-typescript https://babeljs.io/docs/en/babel-preset-typescript

Both work great in combination with rollup.js and their according plugins.

like image 36
htho Avatar answered Sep 19 '22 13:09

htho