Is there a way to suppress TypeScript errors for specific files using the tsconfig.json
file? I am aware of the exclude
property mentioned on the TypeScript website, but that's not exactly what I'm looking for. As it's explained:
If a file B.ts is referenced by another file A.ts, then B.ts cannot be excluded unless the referencing file A.ts is also specified in the "exclude" list.
It makes sense that when you utilize an npm package, TypeScript will always validate it. Even if you try to exclude the entire node_modules
directory or just specific ones, you won't be successful. So if there are TypeScript errors in certain node modules files (due to outdated types, version mismatches, etc.), you're essentially stuck.
What I'm seeking is a means to ignore TypeScript errors in particular library files that I can't modify. Something akin to // @ts-nocheck
, but at the level of tsconfig.json
:
{
"nocheck": [
"node_modules/redux-thunk/index.d.ts"
]
}
The skipLibCheck
compiler option isn't a viable solution. I still want to perform checks on other libraries.