If you have an object type such as:
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.
We should work out some way to avoid this.
If you have an object type such as:
and you use it to change state within an Immer
producecallback — such the callback thatupdatein BaseController v2 takes — then you will get an error:This is happening because
Jsonis a recursive type andDraftandWritableDrafttrampoline as they recurse through thatJsontype. 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.