Skip to content

Commit

Permalink
Merge pull request #1897 from reduxjs/bugfix/v8-merge-dispatchprop
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Apr 13, 2022
2 parents 80fc518 + 7765805 commit 1da5216
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/connect.tsx
Expand Up @@ -312,7 +312,7 @@ export interface Connect<DefaultState = unknown> {
<no_state = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>(
mapStateToProps: null | undefined,
mapDispatchToProps: null | undefined,
mergeProps: MergeProps<undefined, undefined, TOwnProps, TMergedProps>
mergeProps: MergeProps<undefined, DispatchProp, TOwnProps, TMergedProps>
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>

/** mapState and mergeProps */
Expand All @@ -325,7 +325,7 @@ export interface Connect<DefaultState = unknown> {
>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps: null | undefined,
mergeProps: MergeProps<TStateProps, undefined, TOwnProps, TMergedProps>
mergeProps: MergeProps<TStateProps, DispatchProp, TOwnProps, TMergedProps>
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>

/** mapDispatch (as a object) and mergeProps */
Expand Down
8 changes: 8 additions & 0 deletions test/typetests/connect-options-and-issues.tsx
Expand Up @@ -103,6 +103,14 @@ function TestMergedPropsInference() {
merged: 'merged',
})
)(MergedPropsComponent)

const ConnectedWithInferredDispatch = connect(
mapStateToProps,
undefined,
(stateProps, dispatchProps, ownProps) => {
expectType<DispatchProp<AnyAction>>(dispatchProps)
}
)(MergedPropsComponent)
}

function Issue16652() {
Expand Down

0 comments on commit 1da5216

Please sign in to comment.