There are several ways to ignore code in typescript:
this will ignore the code that is one line below
// @ts-ignore const myAge : number = "25" // no typescript error const isTrue : boolean = 4; // error
Usually this would throw an error about variable myAge not being type of number, but with
@ts-ignore this error will be ignored.
// @ts-nocheck const myAge : number = "25" // no error const isTrue : boolean = 4; // no error
@ts-nocheck will ignore the file, so if you want to ignore typescript checking on one function put it in separate file🚨🚨
This typescript rule should be used at the top of the file and it will ignore all code in the file.
**Typescript is meant to be helpful and allows us to write more robust, better structured code. Also it helps us to catch errors early, so use
@ts-nocheck rules with caution.