For me at least the benefit of not having stringly-typed identifiers is that IDEs and linters can easily inspect and autocomplete these for you - http://imgur.com/ub29AqD.
It's the same reason why Swift's enums are so awesome. The point is not that it makes typos easier to detect, but to make typos impossible.
I put all the actions for a reducer into a type object contained in the reducers file. That way you always know which action types are valid for a given reducer, you can simple import the type object instead of individual types, and no typos. Just type reducerNameTypes.<get a list of valid types>
10
u/mediumdeviation JavaScript Gardener May 15 '17
For me at least the benefit of not having stringly-typed identifiers is that IDEs and linters can easily inspect and autocomplete these for you - http://imgur.com/ub29AqD.
It's the same reason why Swift's enums are so awesome. The point is not that it makes typos easier to detect, but to make typos impossible.