Allow implicit any only for definition files

后端 未结 2 640
遥遥无期
遥遥无期 2020-12-11 14:32

I am using TypeScript with the \"noImplicitAny\": true option set in my tsconfig.json.

I am using typings to manage type definition files a

2条回答
  •  我在风中等你
    2020-12-11 15:21

    With the release of TypeScript 2.0, the skipLibCheck compiler option was introduced and it should solve your problem:

    TypeScript 2.0 adds a new --skipLibCheck compiler option that causes type checking of declaration files (files with extension .d.ts) to be skipped. When a program includes large declaration files, the compiler spends a lot of time type checking declarations that are already known to not contain errors, and compile times may be significantly shortened by skipping declaration file type checks.

    Since declarations in one file can affect type checking in other files, some errors may not be detected when --skipLibCheck is specified. For example, if a non-declaration file augments a type declared in a declaration file, errors may result that are only reported when the declaration file is checked. However, in practice such situations are rare.

    It defaults to false and can be enabled in your tsconfig.json:

    {
        "compilerOptions": {
            "skipLibCheck": true,
            ...
        },
        ...
    }
    

提交回复
热议问题