Skip to content

An object type that contains Json causes a recursive error in conjunction with Draft/WritableDraft types from Immer #168

Open
@mcmire

Description

@mcmire

If you have an object type such as:

{
  foo: Json
}

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions