-
-
Couldn't load subscription status.
- Fork 1.3k
Closed
Description
Which project does this relate to?
Router
Describe the bug
In earlier versions it was okay to return an object with a type that contains unknown for one of its properties like:
type TypeWithUnknown = {
value: unknown;
};
export const Route = createFileRoute('/_layout')({
component: RouteComponent,
beforeLoad() {
const obj = { value: {} } as TypeWithUnknown;
return { obj };
},
loader: async ({ context }) => {
return context.obj.value;
},
});
But after updating to version 1.132.6, the above code throws this error:
Call signature return types '{ obj: TypeWithUnknown; }' and '{ obj: { value: {}; }; }' are incompatible.
The types of 'obj.value' are incompatible between these types.
Type 'unknown' is not assignable to type '{}'.
Your Example Website or App
https://stackblitz.com/edit/github-51knrjza-rwsunnqu?file=src%2Froutes%2F_layout.tsx
Steps to Reproduce the Bug or Issue
Go to the _layout file in the code repo above and you should see the errors on beforeLoader and loader
Expected behavior
I believe this is a bug and the behaviour should remain consistent with what it was in earlier versions.
Screenshots or Videos
No response
Platform
- Router Version: [e.g. 1.132.6]
- OS: Linux
- Browser: Chrome
Additional context
No response
Gruak, majoncas-ue, BrendanC23, BourqueCharles and ZECTBynmo
Metadata
Metadata
Assignees
Labels
No labels