![travis](https://travis-ci.org/alanrsoares/re-reduced.svg?branch=master)
Re-reduced
A type-safe functional toolbelt for Redux applications
Type reference
Action<T = void>
interface Action<T = void> {
type: string;
payload: T;
}
ActionCreator<T = void>
interface ActionCreator<TPayload = void> {
(): Action;
(payload: TPayload): Action<TPayload>;
type: string;
reduce: <TState>(
handler: ActionReducer<TPayload, TState>
) => {
[key: string]: ActionReducer<TPayload, TState>
};
}
AsyncActions<TRun, TSuccess>
interface AsyncActions<TRun, TSuccess> extends ActionCreator<TRun> {
request: ActionCreator;
success: ActionCreator<TSuccess>;
failure: ActionCreator<Error>;
}
ActionReducer<TState, TPayload>
type ActionReducer<TPayload, TState> = (s: TState, p: TPayload) => TState;
ActionReducerMap
interface ActionReducerMap<TState> {
[key: string]: ActionReducer<TState, any>;
}
Api
createAction(type: string): Action
const action = createAction();