Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action types are not Typescript friendly #79

Closed
piotrwitek opened this issue May 3, 2022 · 3 comments
Closed

Action types are not Typescript friendly #79

piotrwitek opened this issue May 3, 2022 · 3 comments

Comments

@piotrwitek
Copy link

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
Copy link
Owner

@piotrwitek you are right.
Would you like to open a pr for this?

@AlbertoSadoc
Copy link
Contributor

Maybe fixed with #89 ?

@salvoravida
Copy link
Owner

@piotrwitek fixed https://github.com/salvoravida/redux-first-history/releases/tag/v5.1.1
lmk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants