lam*_*ade 2 type-hinting typescript typescript-typings angular leaflet-geoman
我们有一个开启了严格模式的 Angular 11 应用程序。它在compilerOptions配置中有这些值tsconfig.json:
"strict": true,
"noImplicitReturns": true,
Run Code Online (Sandbox Code Playgroud)
现在我们要使用外部库(传单 geoman)。库是这样导入的:
import * as L from 'leaflet';
import '@geoman-io/leaflet-geoman-free';
Run Code Online (Sandbox Code Playgroud)
不幸的是,它包括隐式any类型以及隐式any返回类型:
参数“options”隐式具有“any”类型。
缺少返回类型注释的“setLang”隐式具有“any”返回类型
如何告诉编译器在编译期间忽略模块中的这些错误,但strict在项目的其余部分保持打开模式?
您可以调用编译器并使用--skipLibCheck标志来实现您想要的。
--skipLibCheck在TypeScript 2.0 中添加: skiplibcheck
tsc --skipLibCheck
您可以在此线程中阅读有关为什么要使用它的更多信息:TypeScript 编译器参数“skipLibCheck”的使用
| 归档时间: |
|
| 查看次数: |
193 次 |
| 最近记录: |