the-dr-lazy / deox

Functional Type-safe Flux Standard Utilities
https://deox.js.org
MIT License
206 stars 12 forks source link

Add ActionType helper #10

Closed the-dr-lazy closed 5 years ago

the-dr-lazy commented 5 years ago

It is handy to have a helper that infers action types that a reducer can handle. A use case scenario for this is creating an epic.

Possible Implementation

type ActionType<T extends Reducer<any, AnyAction>> = T extends Reducer<any, infer Actions>  ? Actions : never
the-dr-lazy commented 5 years ago

Also, ActionType helper should infer action type from action creator.