Skip to content

Commit 5331a1e

Browse files
committed
fix: types
1 parent 86f3f91 commit 5331a1e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/connect/mapDispatchToProps.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
1-
import { ActionCreator, ActionCreatorsMapObject, Dispatch } from 'redux'
1+
import { ActionCreatorsMapObject, Dispatch } from 'redux'
22
import bindActionCreators from '../utils/bindActionCreators'
3-
import { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps'
3+
import {
4+
MapToProps,
5+
wrapMapToPropsConstant,
6+
wrapMapToPropsFunc,
7+
} from './wrapMapToProps'
48

59
export function whenMapDispatchToPropsIsFunction(
6-
mapDispatchToProps: ActionCreatorsMapObject | ActionCreator<any>
10+
mapDispatchToProps: ActionCreatorsMapObject | MapToProps
711
) {
812
return typeof mapDispatchToProps === 'function'
913
? wrapMapToPropsFunc(mapDispatchToProps, 'mapDispatchToProps')
1014
: undefined
1115
}
1216

13-
export function whenMapDispatchToPropsIsMissing(
14-
mapDispatchToProps: ActionCreatorsMapObject | ActionCreator<any>
15-
) {
17+
export function whenMapDispatchToPropsIsMissing(mapDispatchToProps: undefined) {
1618
return !mapDispatchToProps
17-
? wrapMapToPropsConstant((dispatch) => ({ dispatch }))
19+
? wrapMapToPropsConstant((dispatch: Dispatch) => ({
20+
dispatch,
21+
}))
1822
: undefined
1923
}
2024

2125
export function whenMapDispatchToPropsIsObject(
22-
mapDispatchToProps: ActionCreatorsMapObject | ActionCreator<any>
26+
mapDispatchToProps: ActionCreatorsMapObject
2327
) {
2428
return mapDispatchToProps && typeof mapDispatchToProps === 'object'
2529
? wrapMapToPropsConstant((dispatch: Dispatch) =>

0 commit comments

Comments
 (0)