UNPKG

642 BTypeScriptView Raw
1import { TypeConstant, ActionCreator } from '../type-helpers';
2export declare type PayloadMetaAction<T extends TypeConstant, P, M> = P extends undefined ? M extends undefined ? {
3 type: T;
4} : {
5 type: T;
6 meta: M;
7} : M extends undefined ? {
8 type: T;
9 payload: P;
10} : {
11 type: T;
12 payload: P;
13 meta: M;
14};
15/**
16 * @description typesafe action-creator factory
17 */
18export declare function createAction<T extends TypeConstant, AC extends ActionCreator<T> = () => {
19 type: T;
20}>(type: T, createHandler?: (actionCallback: <P = undefined, M = undefined>(payload?: P, meta?: M) => PayloadMetaAction<T, P, M>) => AC): AC;
21
\No newline at end of file