-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Description
Do you want to request a feature or report a bug?
Bug
export default mapHandlers<SingleChoice>({
select(state, {value}: SelectAction) {
return input(state, value)
},
reset(state) {
return input(state, "")
},
validate(state) {
return input(state, state.value)
},import {Action, Reducer} from "redux"
export type HandlerMapObject<S> = {
[name: string]: Reducer<S>
}
export default
function mapHandlers<S>(
handlers: HandlerMapObject<S>,
defaultReducer?: Reducer<S>
): Reducer<S> {
return (state, action) => {
const reducer = handlers[action.type] || defaultReducer
if (reducer !== undefined) {
return reducer(state, action)
}
return state
}
}What is the current behavior?
Argument of type '{ select(state: SingleChoice, { value }: SelectAction): SingleChoice; reset(state: SingleChoice):...' is not assignable to parameter of type 'HandlerMapObject<SingleChoice>'. Property 'select' is incompatible with index signature. Type '(state: SingleChoice, { value }: SelectAction) => SingleChoice' is not assignable to type 'Reducer<SingleChoice>'. Types of parameters '__1' and 'action' are incompatible. Type 'AnyAction' is not assignable to type 'SelectAction'. Property 'value' is missing in type 'AnyAction'.
What is the expected behavior?
No errors.
Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?
master - error
3.7.1 - works
This was caused by PR #2467
Metadata
Metadata
Assignees
Labels
No labels
