tRPCttRPC
Powered by
mh15M
tRPCβ€’3y agoβ€’
18 replies
mh15

`The property 'query' in your router collides with a built-in method`

I'm seeing an error (attached) where I can get autocompletes on TRPC in the file where the client is defined, but not anywhere I import it in.

// client.ts
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";

import type { AppRouter } from "wherever";

export const trpcClient = createTRPCProxyClient<AppRouter>({
  links: [
    httpBatchLink({
      url: `whatever`,
      // You can pass any HTTP headers you wish here
      async headers() {
        return {
          authorization: "whatever",
        };
      },
    }),
  ],
});
// client.ts
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";

import type { AppRouter } from "wherever";

export const trpcClient = createTRPCProxyClient<AppRouter>({
  links: [
    httpBatchLink({
      url: `whatever`,
      // You can pass any HTTP headers you wish here
      async headers() {
        return {
          authorization: "whatever",
        };
      },
    }),
  ],
});

It does call the backend but the type checking isn't working.
image.png
Solution
I was reexporting my type signatures in a barrel file. Importing directly fixed the issue.
Jump to solution
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

The property '$request' in your router collides with a built-in method
Ali MMAAli MM / ❓-help
3y ago
Is it possible to call a query from another query defined in the same router?
KrangaKKranga / ❓-help
4y ago