diff --git a/README.md b/README.md index 854a290..e6f2859 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ An action MUST NOT include properties other than `type`, `payload`, `error`, and ### `type` -The `type` of an action identifies to the consumer the nature of the action that has occurred. By convention, `type` is usually a string constant or a Symbol. If two types are the same, they MUST be strictly equivalent (using `===`). +The `type` of an action identifies to the consumer the nature of the action that has occurred. `type` is a string constant. If two types are the same, they MUST be strictly equivalent (using `===`). ### `payload` diff --git a/src/index.d.ts b/src/index.d.ts index 6c8b3dc..7e02074 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -3,7 +3,7 @@ export interface FluxStandardAction { * The `type` of an action identifies to the consumer the nature of the action that has occurred. * Two actions with the same `type` MUST be strictly equivalent (using `===`) */ - type: string | symbol; + type: string; /** * The optional `payload` property MAY be any type of value. * It represents the payload of the action. diff --git a/src/index.js b/src/index.js index babc290..7017b7a 100644 --- a/src/index.js +++ b/src/index.js @@ -1,13 +1,12 @@ import { isPlainObject, isString, - isSymbol, } from 'lodash'; export function isFSA(action) { return ( isPlainObject(action) && - (isString(action.type) || isSymbol(action.type)) && + isString(action.type) && Object.keys(action).every(isValidKey) ); } diff --git a/test/isFSA.test.js b/test/isFSA.test.js index 1970b4d..dfe1981 100644 --- a/test/isFSA.test.js +++ b/test/isFSA.test.js @@ -1,7 +1,6 @@ import { isFSA } from '../src/'; const type = 'ACTION_TYPE'; -const symbolType = Symbol.for(type); describe('isFSA()', () => { it('requires a type', () => { @@ -17,9 +16,7 @@ describe('isFSA()', () => { expect(isFSA(action)).toBe(false); }); - it('only returns true if type is a string or symbol', () => { - // remove this assertion if/when symbol support is dropped - expect(isFSA({ type: symbolType })).toBe(true); + it('only returns true if type is a string', () => { expect(isFSA({ type: true })).toBe(false); expect(isFSA({ type: 123 })).toBe(false); });