trailingSlash: "always"
breaks <Link />
and navigate()
types in v1.91.0 onwards
#3052
Labels
types
Changes to the typescript types
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()
andlinkOptions
types started breaking due to havingtrailingSlash: "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 asearch
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
routes/index.tsx
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 addedtrailingSlash: "always"
in the router config and simplified the homepage to just include a link to thispage-1
routeExpected behavior
There should be no type errors for this simple use case.
Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: