Skip to content

Commit e89a0dd

Browse files
committed
Switch back to simpler bindActionCreators implementation
1 parent ed40ee6 commit e89a0dd

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

src/utils/bindActionCreators.ts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
1-
import {
2-
ActionCreator,
3-
ActionCreatorsMapObject,
4-
AnyAction,
5-
Dispatch,
6-
} from 'redux'
7-
8-
function bindActionCreator<A extends AnyAction = AnyAction>(
9-
actionCreator: ActionCreator<A>,
10-
dispatch: Dispatch
11-
) {
12-
return function (this: any, ...args: any[]) {
13-
return dispatch(actionCreator.apply(this, args))
14-
}
15-
}
1+
import { ActionCreatorsMapObject, Dispatch } from 'redux'
162

173
export default function bindActionCreators(
18-
actionCreators: ActionCreator<any> | ActionCreatorsMapObject,
4+
actionCreators: ActionCreatorsMapObject,
195
dispatch: Dispatch
206
) {
21-
if (typeof actionCreators === 'function') {
22-
return bindActionCreator(actionCreators, dispatch)
23-
}
24-
25-
const boundActionCreators: ActionCreatorsMapObject = {}
7+
const boundActionCreators: ActionCreatorsMapObject<any> = {}
268
for (const key in actionCreators) {
279
const actionCreator = actionCreators[key]
2810
if (typeof actionCreator === 'function') {

0 commit comments

Comments
 (0)