Skip to content

Commit 3baa6b0

Browse files
plievonektsn
authored andcommitted
Update store.watch() typing (#492)
watch callback gives `oldValue` as the second parameter. It may also be `undefined` in case `{immediate: true}` is used, but typing it optional could be inconvenient for most common uses.
1 parent 37e3e2f commit 3baa6b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export declare class Store<S> {
1818
commit: Commit;
1919

2020
subscribe<P extends Payload>(fn: (mutation: P, state: S) => any): () => void;
21-
watch<T>(getter: (state: S) => T, cb: (value: T) => void, options?: WatchOptions): void;
21+
watch<T>(getter: (state: S) => T, cb: (value: T, oldValue: T) => void, options?: WatchOptions): void;
2222

2323
registerModule<T>(path: string, module: Module<T, S>): void;
2424
registerModule<T>(path: string[], module: Module<T, S>): void;

0 commit comments

Comments
 (0)