diff --git a/src/utils/combineReducers.js b/src/utils/combineReducers.js index 54a74a4c82..45e5943f35 100644 --- a/src/utils/combineReducers.js +++ b/src/utils/combineReducers.js @@ -10,7 +10,7 @@ import { ActionTypes } from '../createStore'; function getErrorMessage(key: String, action: Action): string { var actionType = action && action.type; - var actionName = actionType && `"${actionType}"` || 'an action'; + var actionName = actionType && `"${actionType.toString()}"` || 'an action'; return ( `Reducer "${key}" returned undefined handling ${actionName}. ` + diff --git a/test/utils/combineReducers.spec.js b/test/utils/combineReducers.spec.js index 66d1e4e7f0..21be0a3529 100644 --- a/test/utils/combineReducers.spec.js +++ b/test/utils/combineReducers.spec.js @@ -83,6 +83,23 @@ describe('Utils', () => { ); }); + it('should allow a symbol to be used as an action type', () => { + const increment = Symbol('INCREMENT'); + + const reducer = combineReducers({ + counter(state = 0, action) { + switch (action.type) { + case increment: + return state + 1; + default: + return state; + } + } + }); + + expect(reducer(0, {type: increment}).counter).toEqual(1); + }); + it('should throw an error if a reducer attempts to handle a private action', () => { expect(() => combineReducers({ counter(state, action) {