Skip to content

Commit

Permalink
fix(types): remove this annotation from mutations
Browse files Browse the repository at this point in the history
  • Loading branch information
sue71 committed Jul 18, 2018
1 parent 2c29024 commit 21c8edb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
12 changes: 6 additions & 6 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export declare class Store<S> {

hotUpdate(options: {
actions?: ActionTree<S, S>;
mutations?: MutationTree<S, S>;
mutations?: MutationTree<S>;
getters?: GetterTree<S, S>;
modules?: ModuleTree<S>;
}): void;
Expand Down Expand Up @@ -81,7 +81,7 @@ export interface StoreOptions<S> {
state?: S;
getters?: GetterTree<S, S>;
actions?: ActionTree<S, S>;
mutations?: MutationTree<S, S>;
mutations?: MutationTree<S>;
modules?: ModuleTree<S>;
plugins?: Plugin<S>[];
strict?: boolean;
Expand All @@ -95,15 +95,15 @@ export interface ActionObject<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, R> = (this: Store<R>, state: S, payload: any) => any;
export type Mutation<S> = (state: S, payload: any) => any;
export type Plugin<S> = (store: Store<S>) => any;

export interface Module<S, R> {
namespaced?: boolean;
state?: S | (() => S);
getters?: GetterTree<S, R>;
actions?: ActionTree<S, R>;
mutations?: MutationTree<S, R>;
mutations?: MutationTree<S>;
modules?: ModuleTree<R>;
}

Expand All @@ -119,8 +119,8 @@ export interface ActionTree<S, R> {
[key: string]: Action<S, R>;
}

export interface MutationTree<S, R> {
[key: string]: Mutation<S, R>;
export interface MutationTree<S> {
[key: string]: Mutation<S>;
}

export interface ModuleTree<R> {
Expand Down
13 changes: 2 additions & 11 deletions types/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ namespace RootModule {
}
},
mutations: {
bar (state, payload) {
this.state.value;
}
bar (state, payload) {}
},
strict: true
});
Expand All @@ -94,9 +92,7 @@ namespace RootDefaultModule {
}
},
mutations: {
bar (state, payload) {
this.state.value;
}
bar (state, payload) {}
},
strict: true
});
Expand Down Expand Up @@ -163,11 +159,6 @@ namespace NestedModules {
foo(context: ActionStore, payload) {
this.state.a;
}
},
mutations: {
bar(state, payload) {
this.state.b.e;
}
}
}
}
Expand Down

0 comments on commit 21c8edb

Please sign in to comment.