-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[Bug]: useParams type always adds undefined #11295
Comments
This is an interesting point. If Note that you should not expect to get |
Correct. I used |
This is expected because React Router cannot be sure in what context you're calling It's worth noting that we are aware that React Router and Remix are not as type-safe/type-inferred as they could be and that's something we're actively thinking about when considering future Remix verisons/APIs. This would include Remix SPA mode - the bridge we're building to ensure React Router apps have a smooth path to get all the latest goodies as well. |
Thanks @brophdawg11 . That's a good explanation, that Love the SPA mode. I have always had to build the code splitting :D |
What version of React Router are you using?
6
Steps to Reproduce
token
type isstring | undefined
token2
type isstring | null | undefined
It seems that the
Params
type is extended to always includeundefined
.(also, for some reason
interface
does not work!)Expected Behavior
The supplied type/interface for
useParams
should not be extended to includeundefined
.Actual Behavior
The supplied type/interface for
useParams
is always extended to includeundefined
.The text was updated successfully, but these errors were encountered: