123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- import type { Action, AnyAction } from 'redux';
- import type { CaseReducer, CaseReducers, ActionMatcherDescriptionCollection } from './createReducer';
- import type { TypeGuard } from './tsHelpers';
- export interface TypedActionCreator<Type extends string> {
- (...args: any[]): Action<Type>;
- type: Type;
- }
- export interface ActionReducerMapBuilder<State> {
-
- addCase<ActionCreator extends TypedActionCreator<string>>(actionCreator: ActionCreator, reducer: CaseReducer<State, ReturnType<ActionCreator>>): ActionReducerMapBuilder<State>;
-
- addCase<Type extends string, A extends Action<Type>>(type: Type, reducer: CaseReducer<State, A>): ActionReducerMapBuilder<State>;
-
- addMatcher<A>(matcher: TypeGuard<A> | ((action: any) => boolean), reducer: CaseReducer<State, A extends AnyAction ? A : A & AnyAction>): Omit<ActionReducerMapBuilder<State>, 'addCase'>;
-
- addDefaultCase(reducer: CaseReducer<State, AnyAction>): {};
- }
- export declare function executeReducerBuilderCallback<S>(builderCallback: (builder: ActionReducerMapBuilder<S>) => void): [
- CaseReducers<S, any>,
- ActionMatcherDescriptionCollection<S>,
- CaseReducer<S, AnyAction> | undefined
- ];
|