-
Notifications
You must be signed in to change notification settings - Fork 184
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
Types in useHistory
and useRouter
are incorrect
#280
Comments
useHistory
and useRouter
are incorrect
useHistory
and useRouter
are incorrectuseHistory
and useRouter
are incorrect
Please raise a PR if you have better option. |
They are indeed wrong: Test
Output
What types say
It's not really that the given option is not enough, it simply is incorrect. RouterProps is the proper type for the props of |
PR: #281 |
Thanks for merging. Hopefully it will be released soon! :) I forgot to mention one thing
registerRoute is properly typed but not unregisterRouter. However, there is an issue with it because internally it compares using It would require some internal changes to do something like this:
Just though I should let you know |
Thanks for the PR. |
Hi @james-em |
Thanks for getting back. I do not need to call registerRoute or unregisterRoute for my usage. Just though I should let you know they are not usuable for now outside of the "expected" usage described in the README. |
The contexts.d.ts file defines
useHistory
,useRouter
asreadable
when they are objects with functions attached to them.More context:
Since these don't have a subscribe method attached to it, you can't use these functions with svelte's subscribe syntax. And the messy types are annoying to work with.
The text was updated successfully, but these errors were encountered: