From f555d9236b4914fce235729873717f557c924f25 Mon Sep 17 00:00:00 2001 From: sue71 Date: Wed, 27 Jun 2018 17:46:57 +0900 Subject: [PATCH] feat: add type annotation for the context of actions and mutations --- types/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 585b7d6b0b..5c69278352 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -86,7 +86,7 @@ export interface StoreOptions { strict?: boolean; } -export type ActionHandler = (injectee: ActionContext, payload: any) => any; +export type ActionHandler = (this: Store, injectee: ActionContext, payload: any) => any; export interface ActionObject { root?: boolean; handler: ActionHandler; @@ -94,7 +94,7 @@ export interface ActionObject { export type Getter = (state: S, getters: any, rootState: R, rootGetters: any) => any; export type Action = ActionHandler | ActionObject; -export type Mutation = (state: S, payload: any) => any; +export type Mutation = (this: Store, state: S, payload: any) => any; export type Plugin = (store: Store) => any; export interface Module {