how to skip typescript's noImplicitAny=true rule on node modules packages?

只愿长相守 提交于 2019-12-22 04:45:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!