Open
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
Metadata
Assignees
Labels
Type
Projects
Status
🆕 Triaging