-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Which project does this relate to?
Start
Describe the bug
Might be related to this #5222
As it's showing the same error.
So in my project, I have spa mode enabled.
The __root route has ssr: false
The root layout has ssr: false too:
// post.tsx
export const Route = createFileRoute('/posts')({
ssr: false,
loader: async () => fetchPosts(),
component: PostsComponent,
})
function PostsComponent() {}
Then, if I have a page like this:
// posts.$postId.$something.tsx
export const Route = createFileRoute('/posts/$postId/$something')({
loader: ({ params: { postId } }) => "hello" as unknown,
component: ()=>{},
})
The loader would throw the same error linked above:
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 '{}'.
If I put ssr: false on the posts.$postId.tsx, then the error goes away.
But I shouldn't need to have to put that when it's already on the __root and the posts.tsx routes, right?
Your Example Website or App
https://github.com/MTG2000/tanstack-router/tree/type-unknown-issue
Steps to Reproduce the Bug or Issue
Go to start-basic example and see the changes that I mentioned above.
And you will see the error in this file: https://github.com/MTG2000/tanstack-router/blob/type-unknown-issue/examples/react/start-basic/src/routes/posts.%24postId.%24something.tsx
Expected behavior
No type error when ssr is disabled on a parent layout or root layout.
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.133.15
- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Browser Version: [e.g. 91.1]
- Bundler: vite
- Bundler Version: [e.g. 7.0.0]
Additional context
No response