Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export declare class Store<S> {
dispatch: Dispatch;
commit: Commit;

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

registerModule<T>(path: string, module: Module<T, S>): void;
Expand Down Expand Up @@ -59,6 +59,10 @@ export interface Payload {
type: string;
}

export interface MutationPayload extends Payload {
payload: any;
}

export interface DispatchOptions {
root?: boolean;
}
Expand Down
1 change: 1 addition & 0 deletions types/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace StoreInstance {

store.subscribe((mutation, state) => {
mutation.type;
mutation.payload;
state.value;
});

Expand Down