如何在节点模块软件包上跳过打字稿的noImplicitAny = true规则? [英] how to skip typescript's noImplicitAny=true rule on node modules packages?
问题描述
我正在使用Typescript 2和Webpack 2构建angular 2应用程序.作为加载程序,我使用awesome-typescript-loader.我在tsconfig.json中设置了noImplicitAny = true.但是我隐式使用的某些npm软件包具有"any"类型. (例如angular2-platform-node).因此,我只想在npm软件包上跳过该规则,而不要在我的应用程序源上跳过该规则.我该如何配置?
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?
推荐答案
您可以使用skipLibCheck
编译器选项(在打字稿2.0中添加)跳过对所有声明文件的类型检查
You can skip type checking for all declaration files with skipLibCheck
compiler option (added in typescript 2.0)
{
"compilerOptions": {
"noImplicitAny": true,
"skipLibCheck": true,
...
}
这篇关于如何在节点模块软件包上跳过打字稿的noImplicitAny = true规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!