Skip to content

Commit

Permalink
feat: add type annotation for the context of actions and mutations
Browse files Browse the repository at this point in the history
  • Loading branch information
sue71 committed Jun 27, 2018
1 parent caa663d commit f555d92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ export interface StoreOptions<S> {
strict?: boolean;
}

export type ActionHandler<S, R> = (injectee: ActionContext<S, R>, payload: any) => any;
export type ActionHandler<S, R> = (this: Store<S>, injectee: ActionContext<S, R>, payload: any) => any;
export interface ActionObject<S, R> {
root?: boolean;
handler: ActionHandler<S, R>;
}

export type Getter<S, R> = (state: S, getters: any, rootState: R, rootGetters: any) => any;
export type Action<S, R> = ActionHandler<S, R> | ActionObject<S, R>;
export type Mutation<S> = (state: S, payload: any) => any;
export type Mutation<S> = (this: Store<S>, state: S, payload: any) => any;
export type Plugin<S> = (store: Store<S>) => any;

export interface Module<S, R> {
Expand Down

0 comments on commit f555d92

Please sign in to comment.