Action types are not Typescript friendly
piotrwitek opened this issue · 3 comments
piotrwitek commented
Action types are not Typescript friendly, they should return Action with its type declared as a string literal type. This would make it possible to be leveraged in various typesafe libraries such as typesafe-actions
for discriminated unions.
Please check here for a nice example of TypeScript friendly types declaring a type as a literal string type: https://github.com/supasate/connected-react-router/blob/master/index.d.ts#L65.
export declare const push: (...args: Parameters<History['push']>) => ReduxAction;
export declare const replace: (...args: Parameters<History['replace']>) => ReduxAction;
export declare const go: (...args: Parameters<History['go']>) => ReduxAction;
export declare const goBack: () => ReduxAction;
export declare const goForward: () => ReduxAction;
export declare const back: () => ReduxAction;
export declare const forward: () => ReduxAction;
salvoravida commented
@piotrwitek you are right.
Would you like to open a pr for this?
AlbertoSadoc commented
Maybe fixed with #89 ?