import { Action , AnyAction } from 'redux' ; import { SubReducer , TypedActionCreator } from './types' ; param type param actionReducer export default function onAction < S = any , T extends string | symbol | number = any , A extends Action < T > = AnyAction > ( type , actionReducer ) ; export default function onAction < S = any , A extends Action = AnyAction > ( actionCreator , actionReducer ) ; export default function onAction < S = any , T = any , A extends Action < T > = AnyAction > ( actionTypeOrCreator , actionReducer ) { const actionType = typeof actionTypeOrCreator === 'string' || typeof actionTypeOrCreator === 'number' || typeof actionTypeOrCreator === 'symbol' ? actionTypeOrCreator : actionTypeOrCreator . type ; return function onActionReducer ( state , action ) { return action . type === actionType ? actionReducer ( state , action as A ) : state ; } ; }