您如何解决 d.ts 文件中的 angular 打字稿错误?特别是msal

How do you solve angular typescript errors in d.ts files? Specifically msal

我正在使用 Msal (https://github.com/AzureAD/microsoft-authentication-library-for-js) 和最新的 angular 设置,包括 Typescript 3.1.1,我收到以下错误:

ERROR in node_modules/msal/lib-commonjs/UserAgentApplication.d.ts(35,9):
error TS2717: Subsequent property declarations must have the same type.
Property 'callBackMappedToRenewStates' must be of type 'any', but here has type '{}'.

查看节点模块中的代码我可以看到问题,但显然我宁愿不编辑此文件或创建自定义类型文件来解决此问题。我该怎么办?

您应该检查您是否为此库使用了正确版本的 Typescript。

如果是,请忽略 // @ts-ignoreany 类型声明的 Typescript 错误,并等待修复。

tsconfig 可以采用 skipLibCheck 属性,它将跳过所有声明文件中的类型检查。继续这样做直到 msal 得到修复 - 真的不想要它,因为它确实会消除所有包的所有错误。