FluX
FluX2mo ago

Type errors when deploying to Vercel using new client integration

Hey, wondering if anyone else had a similar issue and found a fix for it. I have a Turborepo monorepo with a Next.js app and a trpc package. When trying to deploy to Vercel, I'm getting type errors like Property 'map' does not exist on type '() => never'. The relevant code snippet would be this:
export const Component = () => {
const trpc = useTRPC()
const { data, isLoading } = useQuery(trpc.my.endpoint.queryOptions())

return (
<div>
{!isLoading && data && data.length && (
<div>
{data.map((c, i) => (
/* ... */
))}
</div>
)}
</div>
)
}
export const Component = () => {
const trpc = useTRPC()
const { data, isLoading } = useQuery(trpc.my.endpoint.queryOptions())

return (
<div>
{!isLoading && data && data.length && (
<div>
{data.map((c, i) => (
/* ... */
))}
</div>
)}
</div>
)
}
The error doesn't make any sense to me. My guess is that the types of my router are not available in the Vercel environment and thus the type of data is wrong. Locally the build works without problems. Anyone perhaps knows a fix for this? Thanks :)
1 Reply
FluX
FluXOP2mo ago
GitHub
bug: Type error in homepage demo of new tanstack query client · Is...
Provide environment information N/A Describe the bug In the stackblitz embedded in the home page, greeting.data is typed as ()=&gt;never. Link to reproduction https://trpc.io/ To reproduce Go to ht...

Did you find this page helpful?