For some reason the definition of Editor as consuming a Draft<Immutable<T>>, (where Draft from Immer was intended to undo the Immutable mapping), leads to problems for indexed object structures.
An example error reads like...
Type 'Evidenced' cannot be used to index type 'Draft<{ [k in Evidenced]: boolean; }>
Changing the definition of Editor like this...
// BEFORE
export declare type Editor<T> = (draft: Draft<T>) => void;
// AFTER
export declare type Editor<T> = (draft: T) => void;
...should address some issues.
Incidentally this remnant from the use of Immer's castDraft is still in the documentation, which is a mistake.
* @param castDraft Unsafely casts `Immutable` references to mutable to use them
* in the next draft.
For some reason the definition of Editor as consuming a
Draft<Immutable<T>>
, (whereDraft
from Immer was intended to undo theImmutable
mapping), leads to problems for indexed object structures.An example error reads like...
Type 'Evidenced' cannot be used to index type 'Draft<{ [k in Evidenced]: boolean; }>
Changing the definition of Editor like this...
...should address some issues.
Incidentally this remnant from the use of Immer's castDraft is still in the documentation, which is a mistake.