TypeScript: ignore compilation errors with ts-ignore

TypeScript: ignore compilation errors with ts-ignore

Sometimes, during client side development in TypeScript, your project might not compile. Not because of your fault, but because you don't have a declaration files for libraries you are using (my typical case), or because these libraries could be outdated (never happened to me yet).

Still, you need to make you TypeScript project to compile... how do you do?

The suggested approach would be to write the declaration file for the libraries you are using (you can start with a lot of any... until you have time to improve them).

Other times this is not possible, because of various reasons (time, for example).

Still, you want to make your TypeScript project to compile.

How can you do it? Use ts-ignore, introduced in TypeScript 2.6.

// @ts-ignore

Of course, be careful, because in this case, the compiler will accept everything, so it's now your responsibility to check that you write correct code!