Suppress errors in .ts files using ‘// @ts-ignore’ comments

TypeScript 2.6 support suppressing errors in .js files using // @ts-ignore comments placed above the offending lines.

Example

  1. if (false) {
  2. // @ts-ignore: Unreachable code error
  3. console.log("hello");
  4. }

A // @ts-ignore comment suppresses all errors that originate on the following line.It is recommended practice to have the remainder of the comment following @ts-ignore explain which error is being suppressed.

Please note that this comment only suppresses the error reporting, and we recommend you use this comments very sparingly.