generated from MetaMask/metamask-module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
An object type that contains Json
causes a recursive error in conjunction with Draft
/WritableDraft
types from Immer
#168
Comments
Some starting points for tackling the "Type instantiation is excessively deep" error:
This might not be enough to resolve the issue if the mutual recursion depth is infinite even with tail call elimination. |
Might be resolved by TypeScript 5.5: microsoft/TypeScript#57293 |
3 tasks
3 tasks
montelaidev
added a commit
to MetaMask/core
that referenced
this issue
May 29, 2024
## Explanation This PR is a temp fix for the type error `Type instantiation is excessively deep and possibly infinite.` when updating the state. ## References Related to: MetaMask/utils#168 ## Changelog ### `@metamask/accounts-controller` - **FIXED**: Type error during state update ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate
3 tasks
MajorLift
added a commit
to MetaMask/core
that referenced
this issue
Jul 11, 2024
3 tasks
I checked the Immer repo and it looks like this problem still exists: immerjs/immer#839 |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
If you have an object type such as:
and you use it to change state within an Immer
produce
callback — such the callback thatupdate
in BaseController v2 takes — then you will get an error:This is happening because
Json
is a recursive type andDraft
andWritableDraft
trampoline as they recurse through thatJson
type. There's an open bug report on the Immer issue tracker with a proposed fix that was eventually reverted.We should work out some way to avoid this.
The text was updated successfully, but these errors were encountered: