updux/dist/updux.d.ts

31 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-10-24 15:52:36 +00:00
import { UpduxConfig, Dictionary, Action, ActionCreator, Mutation, Upreducer, UpduxDispatch } from './types';
import { Middleware, Store } from 'redux';
2019-11-05 01:34:14 +00:00
export { actionCreator } from './buildActions';
2019-10-24 15:52:36 +00:00
declare type StoreWithDispatchActions<S = any, Actions = {
[action: string]: (...args: any) => Action;
}> = Store<S> & {
dispatch: {
[type in keyof Actions]: (...args: any) => void;
};
};
2019-11-05 01:34:14 +00:00
export declare type Dux<S> = Pick<Updux<S>, 'subduxes' | 'actions' | 'initial' | 'mutations' | 'reducer' | 'middleware' | 'createStore' | 'upreducer'>;
2019-10-24 15:52:36 +00:00
export declare class Updux<S = any> {
subduxes: Dictionary<Updux>;
initial: S;
2019-11-05 01:34:14 +00:00
groomMutations: (mutation: Mutation<S>) => Mutation<S>;
private localEffects;
private localActions;
private localMutations;
constructor(config?: UpduxConfig);
readonly middleware: Middleware<{}, S, UpduxDispatch>;
readonly actions: Dictionary<ActionCreator>;
readonly upreducer: Upreducer<S>;
readonly reducer: (state: S | undefined, action: Action) => S;
readonly mutations: Dictionary<Mutation<S>>;
2019-11-06 00:47:27 +00:00
readonly subduxUpreducer: Upreducer<any>;
2019-11-05 01:34:14 +00:00
readonly createStore: () => StoreWithDispatchActions<S>;
readonly asDux: Dux<S>;
2019-11-06 00:47:27 +00:00
addMutation<A extends ActionCreator>(creator: A, mutation: Mutation<S, A extends (...args: any[]) => infer R ? R : never>, isSink?: boolean): void;
2019-10-24 15:52:36 +00:00
}
export default Updux;
//# sourceMappingURL=updux.d.ts.map