I have a large typescript file that I've inherited. The compiler has many complaints with this file, however it works just fine.
I'll come back to it, but is there any way to suppress all warnings/errors in a specific file?
Join Stack Overflow to learn, share knowledge, and build your career.
I have a large typescript file that I've inherited. The compiler has many complaints with this file, however it works just fine.
I'll come back to it, but is there any way to suppress all warnings/errors in a specific file?
You can use // @ts-nocheck
at the top of the file
Files
Look how its done in the code above.
Check references.
https://devblogs.microsoft.com/typescript/announcing-typescript-3-7/ https://github.com/microsoft/TypeScript/wiki/Type-Checking-JavaScript- https://www.freereikicourse.com/
3.7
of typescript to get this feature.
– Tom Saleeba
Sep 21 '20 at 6:25
This is a little known trick. 2 steps:
/// <reference no-default-lib="true"/>
{
"compilerOptions": {
"skipDefaultLibCheck": true
}
}
Side note, as of 2019.4.11, skipDefaultLibCheck
option is marked as DEPRECATED in the doc, but the feature still exists in source code, see this line.
You can suppress errors in .ts files using // @ts-ignore
comments
But unfortunately it only works for lines. so you will end up putting loads in.
I don't think there is a blanket ignore yet.