`to` and `from` allow the `string` type
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
Which project does this relate to?
Router
Describe the bug
As the title says, to accepts the string type, meaning that these examples will be "valid":
router.navigate({ to: `/posts?filter=${filter}` });
<Link to={`/posts?filter=${filter}`} />
Your Example Website or App
https://stackblitz.com/edit/github-vg75qp?file=src%2Fmain.tsx
Steps to Reproduce the Bug or Issue
- Pass a value of type
stringtoto
Expected behavior
The string type should not be accepted by to's type
Screenshots or Videos
No response
Platform
- OS: Windows
- Browser: Chrome
- Version: 130.0.6723.59
Additional context
I don't know if this is intentional, but it's making migrating away from another router more difficult as we can't automatically trust links/navigations.
Contributor guide
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 with the Router type definitions for the to and from options, using the linked StackBlitz example to reproduce the accepted string type. The issue is done when plain string values are rejected for both navigation and Link usage while valid route values remain accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100