Skip to content

Commit 2bdcf66

Browse files
artgillespietimdorr
authored andcommitted
Revert "Add warning when bindActionCreators encounters non-function property (#2279)" (#2473)
This reverts commit 1b154e0.
1 parent 6c7fe8e commit 2bdcf66

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

src/bindActionCreators.js

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import warning from './utils/warning'
2-
31
function bindActionCreator(actionCreator, dispatch) {
42
return (...args) => dispatch(actionCreator(...args))
53
}
@@ -44,8 +42,6 @@ export default function bindActionCreators(actionCreators, dispatch) {
4442
const actionCreator = actionCreators[key]
4543
if (typeof actionCreator === 'function') {
4644
boundActionCreators[key] = bindActionCreator(actionCreator, dispatch)
47-
} else {
48-
warning(`bindActionCreators expected a function actionCreator for key '${key}', instead received type '${typeof actionCreator}'.`)
4945
}
5046
}
5147
return boundActionCreators

test/bindActionCreators.spec.js

-9
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ describe('bindActionCreators', () => {
1717
})
1818

1919
it('wraps the action creators with the dispatch function', () => {
20-
const _console = console
21-
global.console = { error: jest.fn() }
2220
const boundActionCreators = bindActionCreators(actionCreators, store.dispatch)
2321
expect(
2422
Object.keys(boundActionCreators)
@@ -33,13 +31,9 @@ describe('bindActionCreators', () => {
3331
expect(store.getState()).toEqual([
3432
{ id: 1, text: 'Hello' }
3533
])
36-
expect(console.error).toHaveBeenCalled()
37-
global.console = _console
3834
})
3935

4036
it('skips non-function values in the passed object', () => {
41-
const _console = console
42-
global.console = { error: jest.fn() }
4337
const boundActionCreators = bindActionCreators({
4438
...actionCreators,
4539
foo: 42,
@@ -53,9 +47,6 @@ describe('bindActionCreators', () => {
5347
).toEqual(
5448
Object.keys(actionCreatorFunctions)
5549
)
56-
// 6 instead of 5 because of `__esModule: true` property from importing `actionCreators`
57-
expect(console.error.mock.calls.length).toBe(6)
58-
global.console = _console
5950
})
6051

6152
it('supports wrapping a single function only', () => {

0 commit comments

Comments
 (0)