Recently, I made updates to my Ionic/Angular project and now it is running Angular version 16.1.3
along with TypeScript version 5.1.3
.
In addition to this, my project also includes the following dependencies:
"lodash-es": "^4.17.21",
"@types/lodash": "^4.14.195",
"@types/lodash-es": "^4.17.7",
However, upon trying to run my project, I am encountering some perplexing errors...
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> {
The first error message
TS2589: Type instantiation is excessively deep and possibly infinite.
seems confusing as the type does not seem too complex. Upon inspecting the type definitions, we can see that it's just defining interfaces like:
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>;
}
The second error relates to LoDashExplicitWrapper<T>
. It mentions a discrepancy in the types returned by entries().pop()
, but there isn't an entries()
property in LoDashImplicitWrapper
; only two invokeMap
methods exist.
It's puzzling why these particular errors are surfacing. Any insights on this issue?