-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
typesChanges to the typescript typesChanges to the typescript types
Description
Which project does this relate to?
Router
Describe the bug
This piece of code
export const Route = createFileRoute('/_authenticated')({
beforeLoad: ({ context }) => {
return {
crumbs: [
...context.crumbs,
{
text: 'Some Text',
// ❌ This line breaks type inference
to: Route.fullPath,
},
],
};
},
component: RouteComponent,
});works ok in 1.130.12 without any TS errors
Your Example Website or App
https://stackblitz.com/edit/github-vblwkxuv?file=src%2Froutes%2F_authenticated%2Froute.tsx
Steps to Reproduce the Bug or Issue
Use the code example above in versions beyond 1.130.12. The fact that we are using the Route reference inside beforeLoad causes the type error. (there is no actual runtime error, since this is valid object reference inside the function body, similar to
function createObj(x: string) {
return function <T>(x: T) {
return x
}
}
const test = createObj('')({
a: 1,
func: () => {
return test.a
},
}))
Expected behavior
For the above code to work with no type errors
Screenshots or Videos
Platform
- Router: 1.134.13
- OS: Linux
- Browser: Chrome
- Browser Version: 142.0.7444.134
- Bundler: vite
- Bundler Version: 7.2.2
Additional context
No response
Metadata
Metadata
Assignees
Labels
typesChanges to the typescript typesChanges to the typescript types