UNPKG

941 BTypeScriptView Raw
1import { TypeConstant, ActionCreatorBuilder } from '../type-helpers';
2/** @private */
3export declare type ActionBuilderMap<TType extends TypeConstant, TActionProps extends any, TPayloadArg extends any = undefined, TMetaArg extends any = undefined> = [TMetaArg] extends [undefined] ? [TPayloadArg] extends [undefined] ? () => {
4 type: TType;
5} & TActionProps : (payload: TPayloadArg) => {
6 type: TType;
7} & TActionProps : (payload: TPayloadArg, meta: TMetaArg) => {
8 type: TType;
9} & TActionProps;
10export interface ActionBuilder<T extends TypeConstant> {
11 <P = undefined, M = undefined>(): ActionCreatorBuilder<T, P, M>;
12 map<R, P = undefined, M = undefined>(fn: (payload: P, meta: M) => R): ActionBuilderMap<T, R, P, M>;
13}
14/**
15 * @description create an action-creator of a given function that contains hidden "type" metadata
16 */
17export declare function createStandardAction<T extends TypeConstant>(type: T): ActionBuilder<T>;
18
\No newline at end of file