{"record":{"id":"ba7ee13ca7768f18","repo":"reduxjs/redux","slug":"actions-may-not-have-an-undefined-type-property","errorCode":null,"errorMessage":"Actions may not have an undefined \"type\" property. You may have misspelled an action type string constant.","messagePattern":"Actions may not have an undefined \"type\" property\\. You may have misspelled an action type string constant\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/createStore.ts","lineNumber":280,"sourceCode":"   * a `type` property which may not be `undefined`. It is a good idea to use\n   * string constants for action types.\n   *\n   * @returns For convenience, the same action object you dispatched.\n   *\n   * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n   * return something else (for example, a Promise you can await).\n   */\n  function dispatch(action: A) {\n    if (!isPlainObject(action)) {\n      throw new Error(\n        `Actions must be plain objects. Instead, the actual type was: '${kindOf(\n          action\n        )}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`\n      )\n    }\n\n    if (typeof action.type === 'undefined') {\n      throw new Error(\n        'Actions may not have an undefined \"type\" property. You may have misspelled an action type string constant.'\n      )\n    }\n\n    if (typeof action.type !== 'string') {\n      throw new Error(\n        `Action \"type\" property must be a string. Instead, the actual type was: '${kindOf(\n          action.type\n        )}'. Value was: '${String(action.type)}' (stringified)`\n      )\n    }\n\n    if (isDispatching) {\n      throw new Error('Reducers may not dispatch actions.')\n    }\n\n    try {\n      isDispatching = true","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/reduxjs/redux/blob/3084fc33bb23ab4cab4796172eafe342da4e73d9/src/createStore.ts#L262-L298","documentation":"Even when the action is a plain object, Redux requires a `type` property that is defined. Actions with no type, or with type: undefined, cannot be routed by reducers or recorded by devtools, so dispatch rejects them. This usually indicates a misspelled constant that resolved to undefined.","triggerScenarios":"dispatch({ type: ADD_TODO }) where ADD_TODO is undefined (misspelled or not exported); dispatch({ payload: x }) with no type field at all; action built from a constants object whose key was renamed; reducer/action file using a string literal that got tree-shaken to undefined.","commonSituations":"Renaming an action-type constant in one file but not the action creator; circular import that makes the constant undefined at dispatch time; copy-paste that omits `type:`; destructuring that yields undefined for the type value.","solutions":["Inspect the action object right before dispatch: confirm `action.type` is a defined string.","Check the import for the action-type constant: `import { ADD_TODO } from './types'` and ensure ADD_TODO is exported.","Beware circular imports: move shared constants to a leaf module that no one cycles back from.","Use a linter rule (e.g. eslint-plugin-redux) to flag undefined action types."],"exampleFix":"// before (types.ts exports ADD_TODO, but you imported a typo)\nimport { ADD_TODO } from './types'        // undefined: not exported\ndispatch({ type: ADD_TODO, payload: x })\n\n// after\nimport { ADD_TODO } from './types'\ndispatch({ type: ADD_TODO, payload: x })","handlingStrategy":"validation","validationCode":"if (typeof action.type === 'undefined') {\n  throw new Error(`Action is missing a defined type: ${JSON.stringify(action)}`)\n}\nstore.dispatch(action)","typeGuard":"const hasDefinedType = (a): a is { type: unknown } =>\n  a !== null && typeof a === 'object' && typeof (a as any).type !== 'undefined'","tryCatchPattern":null,"preventionTips":["Verify the action-type constant is exported and imported correctly.","Beware circular imports that make constants undefined at dispatch time.","Log the action object before dispatch in dev to catch missing types.","Use a typed action creator so type is always a string literal."],"tags":["redux","createstore","dispatch","action-type","undefined"],"backgroundTag":null,"analyzedSha":"3084fc33bb23ab4cab4796172eafe342da4e73d9","analyzedAt":"2026-08-12T13:21:41.727Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}