diff --git a/src/index.ts b/src/index.ts index 629e195..4807c43 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,8 +13,12 @@ export type PayloadlessMutationHandler = export type ActionHandler = (injectee: ActionContext, payload: TPayload) => void | Promise; +export type PromiseActionHandler = + (injectee: ActionContext, payload: TPayload) => Promise; export type PayloadlessActionHandler = (injectee: ActionContext) => void | Promise; +export type PromisePayloadlessActionHandler = + (injectee: ActionContext) => Promise; export type GetterHandler = (state: TModuleState, rootState: TRootState) => TResult; @@ -27,6 +31,11 @@ export type DispatchAccessor = payload: TPayload) => Promise; export type PayloadlessDispatchAccessor = (store: Store | ActionContext) => Promise; +export type PromiseDispatchAccessor = + (store: Store | ActionContext, + payload: TPayload) => Promise; +export type PromisePayloadlessDispatchAccessor = + (store: Store | ActionContext) => Promise; export type CommitAccessor = (store: Store | ActionContext, @@ -42,12 +51,18 @@ export interface StoreAccessors { handler: PayloadlessMutationHandler): PayloadlessCommitAccessor; + dispatch( + handler: PromiseActionHandler): + PromiseDispatchAccessor; dispatch( handler: ActionHandler): DispatchAccessor; dispatchNoPayload( handler: PayloadlessActionHandler): PayloadlessDispatchAccessor; + dispatchNoPayload( + handler: PromisePayloadlessActionHandler): + PromisePayloadlessDispatchAccessor; read( handler: GetterHandler):