Ignore Typescript error*

Typescript is a strongly typed superset of Javascript. Sometimes it can be bothersome. It seems like the biggest pain you are having is finding type definitions for external libraries. To overcome this situation there is the solution to disable type checking in TypeScript 2.6+.

  1. Use ts-no-check

// @ts-nocheck comment enables to ignore type checking for a single file.

  1. Use ts-ignore

// @ts-ignore comment enables the Typescript compiler to ignore the line below it, in this way you can ignore errors on specific lines by adding it.

TS error
Type checking ignored

It is recommended to have the remainder of the comment following @ts-ignore explain which error is being suppressed. // @ts-ignore: Unreachable code error

Conversely, you can choose to check only a few .js files by adding a // @ts-check comment to them without setting --checkJs.

Happy coding!

--

--