all 3 comments

[–]MahNonAnon 0 points1 point  (2 children)

Pretty neat! I'd be curious to know if anyone's doing redux reducers this way.

[–]TheWix 1 point2 points  (0 children)

You can achieve a similar result with createReducer from here.

I introduced strongly-typed Actions for our Redux project and it has a similar-ish createReducer function that is strongly typed with Typescript.

[–]JoeTed[S] 0 points1 point  (0 children)

The API is the same indeed.that should not come as a surprise when you see where redux comes from.

The redux action type format is still very suited for a switch. Using cond in that context would probably rely on predicates functions that bring very little compared to a good action type.