Skip to content

Commit 09ac097

Browse files
authored
fix: Better applyPatches type (#810)
applyPatches should specify its input as type `T` so that TypeScript can better infer the correct `T` for its output. Fixes #809
1 parent b1fac9d commit 09ac097

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/immerClass.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export class Immer implements ProducersFns {
185185
this.useProxies_ = value
186186
}
187187

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

0 commit comments

Comments
 (0)