Closed
Description
What version of React, ReactDOM/React Native, Redux, and React Redux are you using?
- React: 18.2.0
- ReactDOM: 18.2.0
- Redux: 4.2.0
- React Redux: 8.0.2
What is the current behavior?
The connect
HoC returns incorrect wrapped component prop types when passing null
or undefined
as mapDispatchToProps
argument.
class TestComponent extends React.Component<OwnProps & StateProps> {}
const TestDispatchPropsNull = connect(mapStateToProps, null)(TestComponent)
const verifyNull = <TestDispatchPropsNull foo="bar" />
const TestDispatchPropsUndefined = connect(
mapStateToProps,
undefined
)(TestComponent)
const verifyNonUn = <TestDispatchPropsUndefined foo="bar" />
Codesandbox: https://codesandbox.io/s/nullish-mapdispatchtoprops-q0eolm
What is the expected behavior?
If the connect
HoC accepts null
or undefined
then it should infer the wrapped component props correctly
Which browser and OS are affected by this issue?
No response
Did this work in previous versions of React Redux?
- Yes
Metadata
Metadata
Assignees
Labels
No labels