Can't use ValidateLinkOptions inside createFileRoute
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
When trying to use the type ValidateLinkOptions or similar (like LinkProps) inside the loader of createFileRoute, I get the error
'loader' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
This seems like a regression, because it worked fine in v1.130.12.
Your Example Website or App
https://stackblitz.com/edit/github-mbsacxwx?file=src%2Froutes%2Findex.tsx
Steps to Reproduce the Bug or Issue
Return something typed as ValidateLinkOptions inside a loader. You must have a route that accepts parameters, like /user/$userId.
Expected behavior
This shouldn't happen, as the return type of a loader shouldn't be related to the route names.
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.136.14
- OS: Linux
- Browser: N/A
- Browser Version: N/A
- Bundler: rolldown-vite
- Bundler Version: 7.2.5
Additional context
I using this to declare breadcrumbs, maybe this particular problem can be solved in another way
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 in src/routes/index.tsx and the createFileRoute loader using ValidateLinkOptions or LinkProps. Compare behavior between v1.130.12 and v1.136.14, then trace the route-parameter-dependent type relationship. Done when the reproduction no longer reports the implicit-any error for a loader returning a value typed with these link options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100