Skip to content

Commit

Permalink
fix(ts): use base type as default produce() return type
Browse files Browse the repository at this point in the history
Previously, the draft type was used in anticipation of weird edge cases, but this created a larger problem where `produce()` would return a fully mutable version of the base type.
  • Loading branch information
aleclarson committed Jan 14, 2019
1 parent b52b45e commit 3aa1c4a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/immer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export interface IProduce {
base: T,
recipe: (this: D, draft: D) => Return,
listener?: PatchListener
): Produced<D, Return>
): Produced<T, Return>

/** Curried producer with a default value */
<T = any, Rest extends any[] = [], Return = void, D = Draft<T>>(
Expand Down

0 comments on commit 3aa1c4a

Please sign in to comment.