我刚刚将我的Ionic/Angular项目更新为Angular 16.1.3
,这里更相关的是TypeScript 5.1.3
。
我也有
"lodash-es": "^4.17.21",
"@types/lodash": "^4.14.195",
"@types/lodash-es": "^4.17.7",
我现在在尝试运行时遇到以下错误...
Error: node_modules/@types/lodash/common/common.d.ts:194:15 - error TS2589: Type instantiation is excessively deep and possibly infinite.
[ng]
[ng] 194 interface Object<T> extends LoDashImplicitWrapper<T> {
[ng] ~~~~~~
[ng]
[ng]
[ng] Error: node_modules/@types/lodash/common/common.d.ts:206:15 - error TS2430: Interface 'ObjectChain<T>' incorrectly extends interface 'LoDashExplicitWrapper<T>'.
[ng] The types returned by 'entries().pop()' are incompatible between these types.
[ng] Type 'CollectionChain<string | T[keyof T]>' is missing the following properties from type 'ObjectChain<[string, any]>': assign, assignIn, assignInWith, assignWith, and 11 more.
[ng]
[ng] 206 interface ObjectChain<T> extends LoDashExplicitWrapper<T> {
第一个TS2589: Type instantiation is excessively deep and possibly infinite.
,我不懂,字体一点都不深。看看我们刚刚得到的类型定义
interface Object<T> extends LoDashImplicitWrapper<T> {
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.invokeMap
*/
invokeMap(methodName: string, ...args: any[]): Collection<any>;
/**
* @see _.invokeMap
*/
invokeMap<TResult>(method: (...args: any[]) => TResult, ...args: any[]): Collection<TResult>;
}
第二个错误似乎也与LoDashExplicitWrapper<T>
有关。它声明了The types returned by 'entries().pop()' are incompatible between these types.
,但上面看,在LoDashImplicitWrapper
中没有名为entries()
的属性,只有两个invokeMap
方法。
有谁知道我为什么会犯这些奇怪的错误吗?
1条答案
按热度按时间jaql4c8m1#
Typescript 5.1.3报告了一个错误问题https://github.com/microsoft/TypeScript/issues/54542。
问题中提到的解决方案是将
"skipLibCheck": true
添加到tsconfig.json中。