Description
Which project does this relate to?
Router
Describe the bug
When I updated @tanstack/react-router
and @tanstack/start
from 1.90 to 1.91 all of my <Link />
, navigate()
and linkOptions
types started breaking due to having trailingSlash: "always"
in my router config.
I've replicated in a very simple repo w/ just two routes. Before the upgrade:
After the upgrade:
npm i @tanstack/[email protected] @tanstack/[email protected]
It appears that the behavior of enforcing trailing slashes in Typescript no longer works (runtime behavior is unchanged)
Oddly enough, even if I link to: "/page-1"
without the trailing slash, it's still broken and asks for me to specify a search
parameter even though there's no search param associated with this route:
The moment I remove trailingSlash: "always"
from my router config, the type errors go away.
This bug appears to be introduced in release 1.91.0
and persists for all subsequent versions that I've tried.
Appreciate your help, thanks!
Your Example Website or App
https://github.com/micah-redwood/tanstack-start-trailingslash-bug
Steps to Reproduce the Bug or Issue
- Clone down this repo
- See type error in file
routes/index.tsx
- Revert dependencies to 1.90 for the error to go away:
npm i @tanstack/[email protected] @tanstack/[email protected]
This repo is just a very simple one created by following the docs. I added one extra route: /page-1
and added trailingSlash: "always"
in the router config and simplified the homepage to just include a link to this page-1
route
Expected behavior
There should be no type errors for this simple use case.
Screenshots or Videos
No response
Platform
- OS: MacOS Sonoma (VSCode)
Additional context
No response