问题
I'm building angular 2 app using Typescript 2 and Webpack 2. As a loader I use awesome-typescript-loader. I set noImplicitAny = true in tsconfig.json. But some of npm packages I used implicitly has an 'any' type. (e.g. angular2-platform-node). So I want to skip that rule only on npm packages but not on my app source. How can I configure for that?
回答1:
You can skip type checking for all declaration files with skipLibCheck
compiler option (added in typescript 2.0)
{
"compilerOptions": {
"noImplicitAny": true,
"skipLibCheck": true,
...
}
来源:https://stackoverflow.com/questions/40836657/how-to-skip-typescripts-noimplicitany-true-rule-on-node-modules-packages