Skip to content
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

If you add to much dependencies it gives "Type instantiation is excessively deep and possibly infinite" #42

Open
Vardan-bg opened this issue May 15, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@Vardan-bg
Copy link

Vardan-bg commented May 15, 2023

If you add too much dependencies it gives "Type instantiation is excessively deep and possibly infinite"
When I added last dependency which just and empty object (to avoid circular dependency case) it gives ts error.
image

https://stackblitz.com/edit/typescript-s5bnzn?file=index.ts

@Vardan-bg Vardan-bg added the bug Something isn't working label May 15, 2023
@molszanski
Copy link
Owner

@molszanski
Copy link
Owner

Maybe those suggestions can help you for now? I am trying a new version that could trigger internal typescript type caching to circumvent this and another problem like that. But no luck so far.

@molszanski
Copy link
Owner

Let me know if any of the suggested solutions work for you :)

@jacoobes
Copy link

Could opting for some typescript library types help?
for example, the
export type UnPromisify<T> = T extends Promise<infer U> ? U : T
Could be potentially replaced with Awaited<T>
Since Awaited is nested,

export type UnpromisifyObject<T> = {
  [K in keyof T]: UnPromisify<T[K]>
}

Could be replaced in favor of Awaited<T>, where T extends {}

@molszanski
Copy link
Owner

Thanks @jacoobes, will check it out! 🚀

@Vardan-bg
Copy link
Author

Hi there! Yes, I am aware of this TS limitation :/ https://itijs.org/docs/patterns-and-tips#ts2589-type-instantiation-is-excessively-deep-and-possibly-infinite

thanks grouping helped)

@jacoobes
Copy link

5.1 typescript

microsoft/TypeScript#53246

👀 you might want to see if this optimization can happen

@molszanski
Copy link
Owner

@jacoobes lovely!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants