You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[utils] An object type that contains Json causes a recursive error in conjunction with Draft/WritableDraft types from Immer #10205
and you use it to change state within an Immer produce callback — such the callback that update in BaseController v2 takes — then you will get an error:
Type instantiation is excessively deep and possibly infinite
This is happening because Json is a recursive type and Draft and WritableDraft trampoline as they recurse through that Json type. There's an open bug report on the Immer issue tracker with a proposed fix that was eventually reverted.
changed the title [-]An object type that contains `Json` causes a recursive error in conjunction with `Draft`/`WritableDraft` types from Immer[/-][+][utils] An object type that contains `Json` causes a recursive error in conjunction with `Draft`/`WritableDraft` types from Immer[/+]on Sep 11, 2026
Activity
MajorLift commentedon Jan 24, 2024
Some starting points for tackling the "Type instantiation is excessively deep" error:
0 extends 1trick for extending tail recursion limit: Tail recursion optimization limit 999 may be manipulated microsoft/TypeScript#49459This might not be enough to resolve the issue if the mutual recursion depth is infinite even with tail call elimination.
MajorLift commentedon Feb 23, 2024
Might be resolved by TypeScript 5.5: microsoft/TypeScript#57293
fix: accounts controller type error (#4331)
Suppress ts(2589) error on immer `Draft` type
mcmire commentedon Oct 28, 2024
I checked the Immer repo and it looks like this problem still exists: immerjs/immer#839
fix(accounts-controller): workaround compiler error for recursive type (
[-]An object type that contains `Json` causes a recursive error in conjunction with `Draft`/`WritableDraft` types from Immer[/-][+][utils] An object type that contains `Json` causes a recursive error in conjunction with `Draft`/`WritableDraft` types from Immer[/+]