UNPKG

redux-saga-tools

Version:

A set of utility functions to write saga and reducers easily

23 lines (22 loc) 834 B
export interface Action { type: string; } export interface ActionWithPayload<P> extends Action { payload: P; } export interface AsyncAction<P, S> extends ActionWithPayload<P> { onSuccess: (payload: S) => ActionWithPayload<S>; onFail: (payload: string) => ActionWithPayload<string>; } export declare function createAction(type: string): Action; export declare function createAction<P>(type: string, payload: P): ActionWithPayload<P>; export declare function createAsyncAction<P, S>(type: string, payload: P): AsyncAction<P, S>; export interface SuccessType<T> { payload: T; } declare type FunctionType = (...args: any[]) => any; interface ActionCreatorsMapObject { [actionCreator: string]: FunctionType; } export declare type ActionsUnion<A extends ActionCreatorsMapObject> = ReturnType<A[keyof A]>; export {};