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

feature: typed query params #205

Closed
cleisonmp opened this issue Oct 21, 2024 · 2 comments
Closed

feature: typed query params #205

cleisonmp opened this issue Oct 21, 2024 · 2 comments

Comments

@cleisonmp
Copy link

Would it be possible to add typed search params ex page, search, or other states we want to lift to the url?

Maybe even if it's just a generic to useRouter ex: useRouter<'/accounts',UrlStates>()

@tatethurston
Copy link
Owner

Hey @cleisonmp is this a duplicate of #39?

The issue with adding a second type argument like this is that it doesn't provide any type safety, it just hides the cast. This would be the same as doing:

const query = useRouter().query as UrlStates

@cleisonmp
Copy link
Author

Hey @cleisonmp is this a duplicate of #39?

It's I missed that due to the title, sorry.
That routers:{} solution you proposed would be awesome.

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

2 participants