T
tRPC

Trying to lazy init "createTRPCProxyClient"

Trying to lazy init "createTRPCProxyClient"

Ppeterp8/5/2023
I'm trying to wrap createTRPCProxyClient, but having trouble with the generic. Maybe I'm just a TS idiot, but I thought something like this would work:
export function createTRPC<X extends AnyRouter>(options) {
return createTRPCProxyClient<X>({ links: [/** link stuff */] })
}
export function createTRPC<X extends AnyRouter>(options) {
return createTRPCProxyClient<X>({ links: [/** link stuff */] })
}
I'm getting the following error:
Argument of type '{ links: TRPCLink<X>[]; }' is not assignable to parameter of type 'CreateTRPCClientOptions<X>'.
Type '{ links: TRPCLink<X>[]; }' is not assignable to type 'CreateTRPCClientBaseOptions<X>'.ts(2345)
Argument of type '{ links: TRPCLink<X>[]; }' is not assignable to parameter of type 'CreateTRPCClientOptions<X>'.
Type '{ links: TRPCLink<X>[]; }' is not assignable to type 'CreateTRPCClientBaseOptions<X>'.ts(2345)
What am I not appreciating here? @alexkatt halp me dawg
AKAlex / KATT 🐱8/5/2023
@ me on Monday
Ppeterp8/7/2023
@alexkatt '@ing' you 🙂
AKAlex / KATT 🐱8/7/2023
ah yeah this is because we have TS helpers that ensures that you add a transformer in the client if we have it on the server so what are you trying to do with your wrapper? can you make a ts playground and i can help from there?
Ppeterp8/7/2023
Sure!

Looking for more? Join the community!

T
tRPC

Trying to lazy init "createTRPCProxyClient"

Join Server
Recommended Posts
Get query parameters in middlewareHi! I'm looking to perform authorization inside of middleware and I'm wondering how I can access thetrpc middlewarecan you help me to catch all Response Codes from fetch called via trpc #❓-helpMultiple React Providers?I'm trying to have multiple providers in the same react (they can't be merged w/ virtual routing). IcreateCaller from API NextJS (Pages Directory)Hi, i want to call the procedure I was created in nextJS API.. and I already look at the documentatiWhy transformer: superjson breaks the POST ?With all the GET request I do there seem to be no error, but as soon as I try sending a POST requesttrpc receiving undefinedHello, I am having a few problems with one of my TRPC endpoints not recieving the data sent through How do you invalidate queries in nextjs app?`experimental_createTRPCNextAppDirClient` don't seems to have the useContext so how do i invalidate Do tracked properties still work when using useSuspenseQuery?From the React Query docs: ```By default, access to properties will be tracked, and the component wiProcedure return types are getting inferred as anyHi, I just created a prisma + trpc backend which uses prisma-trpc-generator to generate trpc routersHey 👋I'm looking to use tRPC with app-router specifically with this setup; - My pages are RSC, and I wanHi ! I get this error when i trying to getUser : ❌ tRPC failed on user.getUser: UNAUTHORIZEDwhat is "use" keyword```ts const baseProcedure = t.procedure .input(z.object({ townName: z.string() })) .use((opts) =How to Type a Middleware factory?Lemme first show you what I want, so you can get the gist of it. (Consider me less experienced in tyDoes "enabled" in useInfiniteQuery work?I am trying to prevent the hook to fetch data using "enabled" parameter. It works in useQuery, but uHow to use NextJS tRPC client without hooks?I want to use the vanilla tRPC client in NextJS (both browser+server), but I can't because it doesn'"Fast Refresh" messing with my WebSocketServer in Next.js developmentI got my websockets up and running in **tRPC **+ **Next.js** with this code: ```js import { WebSockt3-turboHey anyone know how to integrate clerk into t3-turbo appavoiding used more hooks than previous renderI understand whats causing the error in my code, im checking if id is defined before calling useQuer