-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
Which project does this relate to?
Router
Describe the bug
When trying to use the router.matchRoute function with a path that is contained within a pathless route, the resulting match result is typed to false. Running the function returns the correct value. It's only TS issue.
Your Example Website or App
https://stackblitz.com/edit/github-trezcbpr?file=src%2Fmain.tsx
Steps to Reproduce the Bug or Issue
- Create route
routes/_pathless/route.tsx - Create nested route
routes/_pathless/nested/$id.tsx - Call
router.matchRoute(use global router instance) with"/nested/$id.tsx"
// match has type 'false'
const match = router.matchRoute({
to: '/nested/$id',
params: {
id: 'someId',
},
});
return match && match.id; // Property 'id' does not exist on type 'never'.(2339)Expected behavior
return type is false | ResolveParams<"/_pathless/nested/$id"> instead of false
Screenshots or Videos
Platform
- Router Version: 1.139.12
- OS: macOS
- Browser: Chrome
- Browser Version: 142.0.7444.176
- Bundler: vite
- Bundler Version: 7.1.7
Additional context
Maybe the same reason as at #1680
Metadata
Metadata
Assignees
Labels
No labels