T
tRPC

Separating routers into their own modules and merging them causes "any" type in client

Separating routers into their own modules and merging them causes "any" type in client

Ssugar_water5/2/2023
Hi all, I've separated my router into multiple files, but when merging them I get any types for all procedures in the client. This happens with both mergeRouters and composing a parent router with multiple child routers. It seems like trpc is loosing type information... I've verified that both my client and server trpc have the same version, 10.23.0, and that my typescript configuration is correct according to the docs. My environment is: node: v19.2.0 npm 8.19.3 Anyone know what's up with this? Thanks!
Nnlucas5/2/2023
Have you reloaded your typescript server? Could you share some of the relevant code?
Kkevin.hill.fortunabmc5/10/2023
Hello, I hope its ok to revive this, with a possibly similiar question... I had / have a nextjs app with a very large router, and I thought it would be a good idea to break it apart into a monorepo because I wanted to be able to create more than one app, with the same api I started here https://github.com/clerkinc/t3-turbo-and-clerk/ and then I broke apart my router into their respective service routers (example, I have a large Asana router, and Dropbox, and Salesforce....) I made each "service" a module in the monorepo, because they also have components and other "service" specific things.... now here is my issue.... how can I build up the big router, from the different modules? I keep running into issues where I can't export "router" from api to each service and add to the router, because then I have to import it back and that's a cycle... So I thought maybe I can import the clients from the services, build middlewares in api and export procedures.... but then I still need to use router from api to build up the whole thing..... Is what I am trying to do even possible? does the whole, complete router need to be exported in one shot? Can I even have external modules bring functionality into the tRPC router? I feel like I must be missing something....
Ssugar_water5/26/2023
Hello, replying back late. Issue was I was using the "Volar" extension in VSCode (since this is a Vue project). I fixed the issue by disabling the extension

Looking for more? Join the community!

T
tRPC

Separating routers into their own modules and merging them causes "any" type in client

Join Server
Recommended Posts
Can i use try/catch in procedures?can i use try/catch in procedures to pass the error when catching errors in my functions?custom query functionI have a use case where I need a trpc procedure call when a specific key is not present in the localTRPC type checking during build failsEnvironment: node 18.6.0, yarn Whats wrong: Type checking at build time fails. . I think this mightcreateTRPCNext config ctx always returns undefined.Hi Everyone. So I'm trying to use TRPC and Nextjs for auth and post query etc. I have client side cStandalone Next.js 13.3.2 errorHi, since the 13.3.2 update of Next.js, I have the following error : ``` TypeError: Cannot read proDoes tRPC works in application network layer (HTTP) or transport network layer (TCP, UDP)?Just wondering if tRPC uses TCP under the hood.returning undefined from server gets stripped on the clientI encounter this issue when working with TRPC React under a Turborepo. But I works fine on Next I sTypeScript, Mono-Repositories and Internal Packages / Project ReferencesI am getting quite frustrate with project references / internal projects and the resolving of types how to integrate with Redis (ioredis)Any middleware?Help to deploy my TRPC proj from a monorepo (turborepo) at VercelI'm trying to learn monorepo with TRPC, both are new for me and Im kind struggling to deploy it becaTRPC ratelimiting endpointsI am currently having some problems with a race condition in my TRPC nextJS api. Essentially what iexpress-session for tRPCI am using express-session for all my servers to create session authentication. Is there something next-prisma-websockets-starter seeds twice on 'pnpm dx'Hi, i'm using this starter template for my app. The `dx` script from package.json runs both `prisma Can you return from an API endpoint before a sync operation is complete?I'm curious, if I have an endpoint that saves something to a DB and I choose to return from the endpuseInfiniteQueryHey i saw on trpc docs that it is used with prisma, but can i so it with drizzle ? How to past cursoTRPC Next/Server Types Broken >10.5.0Hi all, recently I upgraded from 10.5.0 to latest 10.21.2, discovering that I now have type-check erJWT Token is type "never" in frontend.??!!TRPC Backend is sending JWT Token as string but frontend is reading it as type "never". I am using tHow to properly check the contents of prefetched data?I have dynamic route with SSG and if coming product slug is not in db I want to return notFound: trutrpc/next very slowI have set up my project using trpc/next and i have extremely slow queries, simple hello world takinGeneric handler for data.isLoading and data.isErrorHi, I'm looking for a way to create generic interface for useQuery result (budgetData from example b