How to stop error reporting in TypeScript?

The solution for “How to stop error reporting in TypeScript?” can be found here. The following code will assist you in solving the problem.

// this will ignore the code that is one line below
// @ts-ignore
const myAge : number = “25” // no typescript error
const isTrue : boolean = 4; // error

// this will ignore checking the entire file, must be at its top
// @ts-nocheck
const myAge : number = “25” // no error
const isTrue : boolean = 4; // no error

// @ts-expect-error
console.log(47 * “octopus”); //This line will cause an error and TS won’t disturb you because you are using “ts-expect-error” for nothing.

// @ts-expect-error
console.log(1 + 1); //However, here the log() function will output 2, which will not throw an error. Thus, there’s no purpose of using “ts-expect-error”.

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in