Reputation: 4053
I have turned on some compiler switches to report more issues in code (e.g. strict null checks). But I get tens of errors in used libraries, e.g.:
[default] xxx/node_modules/@angular/core/src/util/decorators.d.ts:11:5
Property 'extends' of type 'Type<any> | undefined' is not assignable to string index type 'Function | any[] | Type<any>'.
Is there any way of suppressing/muting/disabling error checking in libraries (e.g. directory node_modules
)?
It can't be a duplicate of Allow implicit any only for definition files because my question is much broader. I am not asking how to disable one specific check (noImplicitAny
) in libraries, but how to disable all checks in libraries. However the answer from that question applies to mine as well - "skipLibCheck": true
disables all checks in libraries.
Upvotes: 18
Views: 16776
Reputation: 1
I solved it by adding "include": ["custom.d.ts"] into tsconfig.json and create custom.d.ts file in the root project directory
custom.d.ts file need to contain code:
declare module "library" {
// I just did import components from library and export them
import { Component } from "library"
export { Component }
}
Upvotes: 0
Reputation: 4053
While this question is not a duplicate of Allow implicit any only for definition files the answer https://stackoverflow.com/a/39917362/1017211 from over there does solve my issue.
Edit tsconfig.json
:
{
"compilerOptions": {
"skipLibCheck": true,
...
},
...
}
Upvotes: 34