Actually require that `action.type` must be a string
markerikson opened this issue · 1 comments
Per #4129 (comment) :
we've always said they should be serializable, and ought to be strings.
Someone over on Twitter said they'd once tried to use Symbols to make them truly unique, but tbh slice namespacing gives you like 95% uniqueness anyway, so I don't see that as a reason to continue to allow them. As mentioned above, TS enums can have number values, but again why would you do that? We want them to be readable in the DevTools.
So, given that we've always effectively said they should be strings, we might as well enforce it.
We should handle this similar to the "oops, you dispatched something that wasn't a plain object" error, and include the actual value in the error message so that there's an indication of what it was. In fact, let's reuse the miniKindOf
logic to give the type and include the actual value if at all possible.