Skip to content

Commit

Permalink
revert(ts): deeply immutable produce() return type
Browse files Browse the repository at this point in the history
Redux users may be using Immer without expecting `produce` to have a deeply immutable return type.

Closes #289 #290
  • Loading branch information
aleclarson committed Jan 14, 2019
1 parent 05157af commit 06c8f6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/immer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ type FromNothing<T> = Nothing extends T ? Exclude<T, Nothing> | undefined : T
/** The inferred return type of `produce` */
type Produced<T, Return> = 1 extends HasVoidLike<Return>
? 1 extends IsVoidLike<Return>
? Immutable<T>
: Immutable<T> | FromNothing<Exclude<Return, void>>
? T
: T | FromNothing<Exclude<Return, void>>
: FromNothing<Return>

type ImmutableTuple<T extends ReadonlyArray<any>> = {
Expand Down

0 comments on commit 06c8f6f

Please sign in to comment.