ionic-team / stencil-redux

MIT License
97 stars 20 forks source link

declare typesafe `Action` #3

Closed nripendra closed 5 years ago

nripendra commented 6 years ago

suggestion:

export declare type Action<T, TOut> = (...args: T[]) => TOut;

Allows for specifying input parameter types and return type. e.g:

registerAccount: Action<IAccount, IReduxAction>;
updateValidationStatus: Action<IAccount | string[], IReduxAction>;

if and when implemented Microsoft/TypeScript#5453 will make things even better in future.

imhoffd commented 5 years ago

Just pushed a commit that adds a lot more type safety to @stencil/redux.

See usage: https://github.com/ionic-team/stencil-redux#stencil-redux

Should have a release out soon. Thanks!