Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable/suppress errors from libraries in TypeScript?

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.

like image 365
monnef Avatar asked Oct 26 '16 12:10

monnef


1 Answers

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,
        ...
    },
    ...
}
like image 137
monnef Avatar answered Oct 07 '22 04:10

monnef