|
1 |
| -import { ActionCreator, ActionCreatorsMapObject, Dispatch } from 'redux' |
| 1 | +import { ActionCreatorsMapObject, Dispatch } from 'redux' |
2 | 2 | import bindActionCreators from '../utils/bindActionCreators'
|
3 |
| -import { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps' |
| 3 | +import { |
| 4 | + MapToProps, |
| 5 | + wrapMapToPropsConstant, |
| 6 | + wrapMapToPropsFunc, |
| 7 | +} from './wrapMapToProps' |
4 | 8 |
|
5 | 9 | export function whenMapDispatchToPropsIsFunction(
|
6 |
| - mapDispatchToProps: ActionCreatorsMapObject | ActionCreator<any> |
| 10 | + mapDispatchToProps: ActionCreatorsMapObject | MapToProps |
7 | 11 | ) {
|
8 | 12 | return typeof mapDispatchToProps === 'function'
|
9 | 13 | ? wrapMapToPropsFunc(mapDispatchToProps, 'mapDispatchToProps')
|
10 | 14 | : undefined
|
11 | 15 | }
|
12 | 16 |
|
13 |
| -export function whenMapDispatchToPropsIsMissing( |
14 |
| - mapDispatchToProps: ActionCreatorsMapObject | ActionCreator<any> |
15 |
| -) { |
| 17 | +export function whenMapDispatchToPropsIsMissing(mapDispatchToProps: undefined) { |
16 | 18 | return !mapDispatchToProps
|
17 |
| - ? wrapMapToPropsConstant((dispatch) => ({ dispatch })) |
| 19 | + ? wrapMapToPropsConstant((dispatch: Dispatch) => ({ |
| 20 | + dispatch, |
| 21 | + })) |
18 | 22 | : undefined
|
19 | 23 | }
|
20 | 24 |
|
21 | 25 | export function whenMapDispatchToPropsIsObject(
|
22 |
| - mapDispatchToProps: ActionCreatorsMapObject | ActionCreator<any> |
| 26 | + mapDispatchToProps: ActionCreatorsMapObject |
23 | 27 | ) {
|
24 | 28 | return mapDispatchToProps && typeof mapDispatchToProps === 'object'
|
25 | 29 | ? wrapMapToPropsConstant((dispatch: Dispatch) =>
|
|
0 commit comments