Which project does this relate to?#
Router
Describe the bug#
When using string templates + string unions, the to prop of navigate() will widen the type of the value to string instead of using the narrowed type.
Your Example Website or App#
https://stackblitz.com/edit/github-nymikapi?file=src%2Fmain.tsx
Steps to Reproduce the Bug or Issue#
- Open example
- Edit file if type errors don't show up
- Notice how
navigate() types can catch issues with from with or without as const, and issues with to with as const.
- Notice how
navigate() types fail to catch issues with to without as const
Expected behavior#
navigate() should work like linkOptions()
Screenshots or Videos#
No response
Platform#
- OS: Windows
- Browser: Chrome
- Version: 131.0.6778.265
Additional context#
Previously related issue: https://github.com/TanStack/router/issues/3029