From 0e109e2a38dafdc0c2bd6bd3892bc66cfe252b16 Mon Sep 17 00:00:00 2001 From: David Sandoz Date: Sun, 10 Mar 2019 14:44:15 +0100 Subject: [PATCH] fix(types): Make mutation and action payload optional in definition file (#1517) * Make mutation payload optional in definition file When testing a mutation without payload in TypeScript, it complains that about the missing payload, even though it's not mandatory. This PR simply makes the payload optional. Fixes #1491 * Make action payload optional in definition file --- 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 46316bb2a..3cd40067a 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -97,7 +97,7 @@ export interface StoreOptions { strict?: boolean; } -export type ActionHandler = (this: Store, injectee: ActionContext, payload: any) => any; +export type ActionHandler = (this: Store, injectee: ActionContext, payload?: any) => any; export interface ActionObject { root?: boolean; handler: ActionHandler; @@ -105,7 +105,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 = (state: S, payload?: any) => any; export type Plugin = (store: Store) => any; export interface Module {