redux
Advanced tools
Comparing version 5.0.0-alpha.5 to 5.0.0-alpha.6
@@ -9,4 +9,3 @@ /** | ||
* performed. Types can be defined as constants and imported from another | ||
* module. It's better to use strings for `type` than Symbols because strings | ||
* are serializable. | ||
* module. These must be strings, as strings are serializable. | ||
* | ||
@@ -19,3 +18,3 @@ * Other than `type`, the structure of an action object is really up to you. | ||
*/ | ||
interface Action<T = any> { | ||
interface Action<T extends string = string> { | ||
type: T; | ||
@@ -22,0 +21,0 @@ } |
@@ -152,2 +152,5 @@ // src/utils/formatProdErrorMessage.ts | ||
} | ||
if (typeof action.type !== "string") { | ||
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : `Action "type" property must be a string. Instead, the actual type was: '${kindOf(action.type)}'. Value was: '${action.type}' (stringified)`); | ||
} | ||
if (isDispatching) { | ||
@@ -154,0 +157,0 @@ throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(9) : "Reducers may not dispatch actions."); |
{ | ||
"name": "redux", | ||
"version": "5.0.0-alpha.5", | ||
"version": "5.0.0-alpha.6", | ||
"description": "Predictable state container for JavaScript apps", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -285,2 +285,10 @@ import $$observable from './utils/symbol-observable' | ||
if (typeof action.type !== 'string') { | ||
throw new Error( | ||
`Action "type" property must be a string. Instead, the actual type was: '${kindOf( | ||
action.type | ||
)}'. Value was: '${action.type}' (stringified)` | ||
) | ||
} | ||
if (isDispatching) { | ||
@@ -287,0 +295,0 @@ throw new Error('Reducers may not dispatch actions.') |
@@ -9,4 +9,3 @@ /** | ||
* performed. Types can be defined as constants and imported from another | ||
* module. It's better to use strings for `type` than Symbols because strings | ||
* are serializable. | ||
* module. These must be strings, as strings are serializable. | ||
* | ||
@@ -19,3 +18,3 @@ * Other than `type`, the structure of an action object is really up to you. | ||
*/ | ||
export interface Action<T = any> { | ||
export interface Action<T extends string = string> { | ||
type: T | ||
@@ -22,0 +21,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
294571
3176