diff --git a/types/redux-actions/index.d.ts b/types/redux-actions/index.d.ts index 45ecf21933..6051ab7afe 100644 --- a/types/redux-actions/index.d.ts +++ b/types/redux-actions/index.d.ts @@ -22,8 +22,10 @@ export interface ActionMeta extends Action { meta: Meta; } +export type ReducerMapValue = Reducer | ReducerNextThrow | ReducerMap; + export interface ReducerMap { - [actionType: string]: Reducer | ReducerNextThrow; + [actionType: string]: ReducerMapValue; } export interface ReducerMapMeta { diff --git a/types/redux-actions/redux-actions-tests.ts b/types/redux-actions/redux-actions-tests.ts index b7eeb2e62f..7fa5744f22 100644 --- a/types/redux-actions/redux-actions-tests.ts +++ b/types/redux-actions/redux-actions-tests.ts @@ -51,6 +51,15 @@ const actionsHandlerWithInitialState = ReduxActions.handleActions({ state = actionsHandlerWithInitialState(0, { type: 'INCREMENT' }); +const actionsHandlerWithRecursiveReducerMap = ReduxActions.handleActions({ + ADJUST: { + UP: (state: number, action: ReduxActions.Action) => state + action.payload, + DOWN: (state: number, action: ReduxActions.Action) => state - action.payload, + } +}, 0); + +state = actionsHandlerWithRecursiveReducerMap(0, { type: 'ADJUST/UP', payload: 1 }); + // ---------------------------------------------------------------------------------------------------- interface TypedState {