updux/src/types.ts

27 lines
591 B
TypeScript
Raw Normal View History

2019-10-23 17:25:39 +00:00
2019-10-23 17:57:40 +00:00
export type Action = {
type: string,
payload?: any,
meta?: any,
}
2019-10-23 17:25:39 +00:00
export type Dictionary<T> = { [key: string]: T };
2019-10-23 21:01:48 +00:00
export type Mutation<S=any> = (payload: any, action: Action) => (state: S) => S ;
2019-10-23 17:28:13 +00:00
2019-10-23 21:47:43 +00:00
export type ActionPayloadGenerator = (...args:any[]) => any;
2019-10-23 18:44:12 +00:00
2019-10-23 19:55:12 +00:00
export type ActionCreator = (...args: any[] ) => Action;
2019-10-23 21:47:43 +00:00
export type UpduxConfig<S=any> = Partial<{
initial: S,
2019-10-23 18:44:12 +00:00
subduxes: {},
actions: {
[ type: string ]: ActionPayloadGenerator
},
mutations: any,
effects: any,
2019-10-23 17:28:13 +00:00
}>;
2019-10-23 21:47:43 +00:00
export type Upreducer<S=any> = (action:Action) => (state:S) => S;