Functional Search Setter causes type error when using ValidateLinkOptions
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
I made a link component using ValidateLinkOptions as explained in the docs. The component works fine if I pass search to link options as an object, but if search is a setter function, I get:
Type '{ test: string; }' is not assignable to type 'never'.
Your Example Website or App
https://stackblitz.com/edit/tanstack-router-oeezf1an?file=src%2Froutes%2Fabout.tsx
Steps to Reproduce the Bug or Issue
Open the link and navigate to src/routes/about.tsx. Notice the two heading components, the one with the functional search setter has a type error.
Expected behavior
There should be no type error
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
Additional context
No response
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 StackBlitz reproduction and inspect src/routes/about.tsx, especially the two heading components using ValidateLinkOptions. Trace the TypeScript types applied to object and functional search values, then verify that the functional setter produces no type error in the reproduction.
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