-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
information neededFurther information is requestedFurther information is requested
Description
Which project does this relate to?
Router
Describe the bug
I'm experiencing a TypeScript issue when using Route.useLoaderData() in latest version of TanStack Router.
The route works correctly at runtime, but TypeScript breaks / loses type inference when accessing loader data.
Your Example Website or App
Steps to Reproduce the Bug or Issue
export const Route = createFileRoute("/users")({
loader: () => {
return {
users: [{ id: 1, name: "John" }],
};
},
component: UsersPage,
});
function UsersPage() {
const data = Route.useLoaderData();
// ❌ TypeScript error or missing type inference here
data.users.map(user => user.name);
return null;
}
Expected behavior
Route.useLoaderData() should return properly inferred types from the route loader, similar to how useLoaderData works in other router implementations.
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.157.11
- OS: Linux
- Browser: Firefox
- Browser Version: 147.0.1
- Bundler: Vite
- Bundler Version: 7.3.1
Additional context
No response
Metadata
Metadata
Assignees
Labels
information neededFurther information is requestedFurther information is requested