-
-
Notifications
You must be signed in to change notification settings - Fork 852
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
TypeScript - Recursive types: Type instantiation is excessively deep and possibly infinite - ts(2589) #839
Comments
I also have this problem. We use recursive types for app state, and we use the |
I've the same problem with type-plus. |
btw, I have fork and released the fix of this in https://github.com/unional/immer, as the PR are not moving. |
OK, I have this as well. Really glad to see that others are hitting this too and I'm not crazy 😆 Posting this here for googleability -- do let me know if there's something I can do to help. Within a nested type I had: type JSONValue =
| string
| number
| boolean
| { [x: string]: {} }
| Array<JSONValue>;```
Which ended up giving me that message. For now I cut out the JSONValue, but happy to look at PRs or do anything else I can do to help!
|
🎉 This issue has been resolved in version 9.0.18 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🐛 Bug Report
I'm using immer in a TypeScript project together with the type-fest library.
type-fest
got updated to2.0.0
recently and since then theproduce
method throws the following TypeScript compiler error when used with aJsonObject
type from type-fest:Type instantiation is excessively deep and possibly infinite - ts(2589)
The error appears as soon as the
draft
variable is added to the produce method. There have been changes to theJsonObject
type intype-fest
, but it doesn't seem that a lot has changed in the type structure. These are the changes between the 1.4.0 and 2.0.0Potentially related to #347.
Link to repro
Codesandbox repro
To Reproduce
Open the Codesandbox
Observed behavior
TypeScript throws a compilation error:
Type instantiation is excessively deep and possibly infinite - ts(2589)
Expected behavior
TypeScript should not throw any error
Environment
We only accept bug reports against the latest Immer version.
setUseProxies(true)
setUseProxies(false)
(ES5 only)The text was updated successfully, but these errors were encountered: