2019-11-07 00:07:06 +00:00
|
|
|
import { Dispatch } 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>;
|
2019-11-07 00:07:06 +00:00
|
|
|
effects?: Dictionary<UpduxMiddleware<S>>;
|
2019-11-05 01:34:14 +00:00
|
|
|
};
|
2019-10-24 15:52:36 +00:00
|
|
|
export declare type Upreducer<S = any> = (action: Action) => (state: S) => S;
|
2019-11-07 00:07:06 +00:00
|
|
|
export interface UpduxMiddlewareAPI<S> {
|
|
|
|
dispatch: UpduxDispatch;
|
|
|
|
getState(): any;
|
|
|
|
getRootState(): S;
|
|
|
|
}
|
|
|
|
export declare type UpduxMiddleware<S = any> = (api: UpduxMiddlewareAPI<S>) => (next: UpduxDispatch) => (action: Action) => any;
|
2019-11-05 01:34:14 +00:00
|
|
|
export {};
|
2019-10-24 15:52:36 +00:00
|
|
|
//# sourceMappingURL=types.d.ts.map
|