router
router copied to clipboard
Relative navigation always expects a `search` param?
Describe the bug
When using navigation (e.g. navigate / redirect) with a from and relative to, it seems TypeScript always complains about the search param being required, even if none of the routes define a validateSearch.
This example works at runtime, but TypeScript complains:
export const Route = createFileRoute('/posts/$postId')({
beforeLoad: () => {
// works, but TypeScript error about required "search" param
throw redirect({
from: Route.fullPath,
to: '../',
});
}
});
Your Example Website or App
https://stackblitz.com/edit/tanstack-router-ycpp7o?file=src%2Froutes%2Fposts.%24postId.tsx
Steps to Reproduce the Bug or Issue
- Open the
posts.$postId.tsxfile and go to the render function - Observe there's a TypeScript error, even though the actual code works
Expected behavior
I expect that if the to route doesn't provide a validateSearch, it's not a required prop and TypeScript doesn't complain.
Screenshots or Videos
Platform
- OS: macOS / Arc
Additional context
No response