router
router copied to clipboard
invalid type inference for loader data of a route instantiated with createRootRouteWithContext
Describe the bug
Type inference doesn't work for loader data returned from useLoaderData() method call on a route instantiated with createRootRouteWithContext().
Your Example Website or App
https://stackblitz.com/edit/tanstack-router-xjbcqb?file=src%2Froutes%2F__root.tsx
Steps to Reproduce the Bug or Issue
- Go to the reproduction url, open the file at
src/routes/__root.tsx. - Compare the inferred types of variables
dataanddata2in the file.
Expected behavior
- Variable
data2should be of type{ hello: string }and notunknown.
Screenshots or Videos
data is of the expected type { hello: string }
data2 is of unexpected type unknown
Platform
- OS: Linux
- Browser: Brave-Browser
- Version: 1.15.7
Additional context
No response