FluXF
tRPC6mo ago
1 reply
FluX

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>
  )
}


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 :)
Was this page helpful?