Skip to content
Myr

revert(ts): deeply immutable produce() return type

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Redux users may be using Immer without expecting `produce` to have a deeply immutable return type. Closes #289 #290

authored by aleclarson · committed by aleclarson · parent 05157af · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:src/immer.d.ts+2 added-2 removed
56 unmodified lines
5758/** The inferred return type of `produce` */59type Produced<T, Return> = 1 extends HasVoidLike<Return>60 ? 1 extends IsVoidLike<Return>61 ? Immutable<T>62 : Immutable<T> | FromNothing<Exclude<Return, void>>61 ? T62 : T | FromNothing<Exclude<Return, void>>63 : FromNothing<Return>6465type ImmutableTuple<T extends ReadonlyArray<any>> = {66 readonly [P in keyof T]: Immutable<T[P]>
148 unmodified lines