Skip to content

[lodash @types/lodash] An issue with lodash typings causing TypeScript compilation error #54638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nikbarseghyan opened this issue Jun 13, 2023 · 5 comments
Labels
Duplicate An existing issue was already created

Comments

@nikbarseghyan
Copy link

nikbarseghyan commented Jun 13, 2023

Bug Report

Description

I encountered TypeScript compilation errors related to the @types/lodash package. The errors occur in the common.d.ts file of the @types/lodash package during the build process.

🙁 Expected Behavior

I expected(аfter upgrading to v5.1.3) the build process to complete without any TypeScript compilation errors associated with the @types/lodash package.
Because in my project we don't use lodash and @types/lodash. I cleared the cache, but that didn't help either.

🙁 Actual Behavior

During the build process, I encountered the following TypeScript compilation errors:

💻 Code

node_modules/@types/lodash/common/common.d.ts:194:15 - error TS2589: Type instantiation is excessively deep and possibly infinite.

194 interface Object<T> extends LoDashImplicitWrapper<T> {
~~

node_modules/@types/lodash/common/common.d.ts:206:15 - error TS2430: Interface 'ObjectChain<T>' incorrectly extends interface 'LoDashExplicitWrapper<T>'.
The types returned by 'entries().pop()' are incompatible between these types.
Type 'CollectionChain<string | T[keyof T]>' is missing the following properties from type 'ObjectChain<[string, any]>': assign, assignIn, assignInWith, assignWith, and 11 more.

206 interface ObjectChain<T> extends LoDashExplicitWrapper<T> {
~~~~~

Found 2 errors in the same file, starting at: node_modules/@types/lodash/common/common.d.ts:194

🙁 Actual behavior

Versions

  • TypeScript version: 5.1.3
  • @types/lodash package version: Not used

Additional Information

I have tried the following solutions, but none of them resolved the issue:

  • Updating dependencies to the latest versions.
  • Clearing the Yarn cache.
  • Reinstalling dependencies.
  • Verifying the TypeScript configuration.

I would greatly appreciate any help or guidance to resolve this issue. If you have any suggestions, workarounds, or insights into the compatibility between Lodash typings and TypeScript, please let me know. Thank you!

@MartinJohns
Copy link
Contributor

Did you try to delete the node_modules/@types/lodash folder? If you don't use lodash it shouldn't exist.

@nikbarseghyan
Copy link
Author

Yes, I deleted node_modules and yarn.lock file but again get the same issue

@rubiesonthesky
Copy link

npm ls @types/lodash or equivalent for yarn (yarn list @types/lodash?) should tell why that library is installed.

But I think, the actual crash could originate from same source as other recent "Type instantiation is excessively deep and possibly infinite." issues.

@ahejlsberg
Copy link
Member

Duplicate of #54542.

@ahejlsberg ahejlsberg added the Duplicate An existing issue was already created label Jun 13, 2023
@typescript-bot
Copy link
Collaborator

This issue has been marked as 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

5 participants