-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
enhancementNew feature or requestNew feature or requesthas workaroundA workaround has been found to deal with the issueA workaround has been found to deal with the issuetypescriptProblem related to TS typingsProblem related to TS typings
Description
What problem does this feature solve?
Typing of params from useRoute.
When you have function with typed arguments
const someFn = (id: string, type: ResourceType) => {}
And when you try to pass a route.params
as an argument
const route = useRoute()
someFn(route.params.resourceId, route.params.type)
You will get error
Argument of type 'string | string[]' is not assignable to parameter of type 'string'.
Type 'string[]' is not assignable to type 'string'.
Screenshot of problem
What does the proposed API look like?
type Params = {
id: string
type: ResourceType
}
const route = useRoute<Params>() // route.params will be typed
Pull Request
n0099, et84121, ib-mkresic, smarlhens, Lmmmmmm-bb and 8 more
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthas workaroundA workaround has been found to deal with the issueA workaround has been found to deal with the issuetypescriptProblem related to TS typingsProblem related to TS typings
Type
Projects
Status
🆕 Triaging