RouteParams for route with both required and multiple optional parameters gives incorrect typing
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 599
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
With RouteParams<'/leagues/:routeId/:slugStr?/:subPage?'> the inferred types seem to parse the route incorrectly.
Expected:
{
routeId: string;
slugStr?: string | undefined;
subPage?: string | undefined;
}
Actual:
{
"routeId/slugStr"?: string | undefined;
subPage?: string | undefined;
}
This is TS 5.6.2 if that makes a difference
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the RouteParams type definition and reproduce the provided route under TypeScript 5.6.2. Trace how the required and optional segments are split, then confirm that the inferred result separates routeId, slugStr, and subPage as shown in the expected type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100