updux/dist/types.d.ts

32 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-10-24 15:52:36 +00:00
import { Dispatch, Middleware } from 'redux';
2019-11-05 01:34:14 +00:00
declare type MaybePayload<P> = P extends object | string | boolean | number ? {
payload: P;
} : {
payload?: P;
2019-10-24 15:52:36 +00:00
};
2019-11-05 01:34:14 +00:00
export declare type Action<T extends string = string, P = any> = {
type: T;
} & MaybePayload<P>;
2019-10-24 15:52:36 +00:00
export declare type Dictionary<T> = {
[key: string]: T;
};
2019-11-05 01:34:14 +00:00
export declare type Mutation<S = any, A extends Action = Action> = (payload: A['payload'], action: A) => (state: S) => S;
2019-10-24 15:52:36 +00:00
export declare type ActionPayloadGenerator = (...args: any[]) => any;
2019-11-05 01:34:14 +00:00
export declare type ActionCreator<T extends string = string, P = any> = {
type: T;
_genericAction?: boolean;
} & ((...args: any[]) => Action<T, P>);
export declare type UpduxDispatch = Dispatch & Dictionary<Function>;
export declare type UpduxConfig<S = any> = {
initial?: S;
subduxes?: {};
actions?: {
[type: string]: ActionCreator;
2019-10-24 15:52:36 +00:00
};
2019-11-05 01:34:14 +00:00
mutations?: any;
groomMutations?: (m: Mutation<S>) => Mutation<S>;
effects?: Dictionary<Middleware<{}, S, UpduxDispatch>>;
};
2019-10-24 15:52:36 +00:00
export declare type Upreducer<S = any> = (action: Action) => (state: S) => S;
2019-11-05 01:34:14 +00:00
export {};
2019-10-24 15:52:36 +00:00
//# sourceMappingURL=types.d.ts.map