Skip to content

Commit

Permalink
fix: Better applyPatches type (#810)
Browse files Browse the repository at this point in the history
applyPatches should specify its input as type `T` so that TypeScript can better infer the correct `T` for its output.

Fixes #809
  • Loading branch information
joshkel authored Jun 24, 2021
1 parent b1fac9d commit 09ac097
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/immerClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export class Immer implements ProducersFns {
this.useProxies_ = value
}

applyPatches<T extends Objectish>(base: Objectish, patches: Patch[]): T {
applyPatches<T extends Objectish>(base: T, patches: Patch[]): T {
// If a patch replaces the entire state, take that replacement as base
// before applying patches
let i: number
Expand Down

0 comments on commit 09ac097

Please sign in to comment.