diff --git a/types/index.d.ts b/types/index.d.ts index db56861f1..4c4e43e64 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -28,7 +28,7 @@ export declare class Store { hotUpdate(options: { actions?: ActionTree; - mutations?: MutationTree; + mutations?: MutationTree; getters?: GetterTree; modules?: ModuleTree; }): void; @@ -48,7 +48,6 @@ export interface Commit { export interface ActionContext { dispatch: Dispatch; - commit: Commit; state: S; getters: any; @@ -81,7 +80,7 @@ export interface StoreOptions { state?: S; getters?: GetterTree; actions?: ActionTree; - mutations?: MutationTree; + mutations?: MutationTree; modules?: ModuleTree; plugins?: Plugin[]; strict?: boolean; @@ -95,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 = (this: Store, state: S, payload: any) => any; +export type Mutation = (state: S, payload: any) => any; export type Plugin = (store: Store) => any; export interface Module { @@ -103,7 +102,7 @@ export interface Module { state?: S | (() => S); getters?: GetterTree; actions?: ActionTree; - mutations?: MutationTree; + mutations?: MutationTree; modules?: ModuleTree; } @@ -119,8 +118,8 @@ export interface ActionTree { [key: string]: Action; } -export interface MutationTree { - [key: string]: Mutation; +export interface MutationTree { + [key: string]: Mutation; } export interface ModuleTree { diff --git a/types/test/index.ts b/types/test/index.ts index 68469bf6d..ca03458d9 100644 --- a/types/test/index.ts +++ b/types/test/index.ts @@ -67,9 +67,7 @@ namespace RootModule { } }, mutations: { - bar (state, payload) { - this.state.value; - } + bar (state, payload) {} }, strict: true }); @@ -94,9 +92,7 @@ namespace RootDefaultModule { } }, mutations: { - bar (state, payload) { - this.state.value; - } + bar (state, payload) {} }, strict: true }); @@ -163,11 +159,6 @@ namespace NestedModules { foo(context: ActionStore, payload) { this.state.a; } - }, - mutations: { - bar(state, payload) { - this.state.b.e; - } } } }