T
tRPC

❓-help

TRPCError class, public readonly cause?: Error; this line should have override function

FFhd12/20/2023
hey i am trying to use the TRPCError for throwing errors in my apps, but i am getting this error, changing the line from public readonly cause?: Error; to public override readonly cause?: Error; fixes the problem the problem but i am doing that in node_modules which is not how this gets resolved, how do i resolve this? when trying to use module arugmentation, i am getting an dupliate declare class error meaning the TRPCError class has already be declared in TRPCError.d.ts file please help me resolve this issue, my @trpc/server and @trpc/client version is
"@trpc/client": "^10.38.5",
"@trpc/server": "^10.38.5",
"@trpc/client": "^10.38.5",
"@trpc/server": "^10.38.5",
my typescript version is above 5 i am using turborepo, this error was not there before, but since i was doing some migration of my trpc code to a seperate trpc package, i am getting these errrors
FFhd12/20/2023
this is the error when i am building my project
No description
Nnlucas12/20/2023
Hm, what node and typescript versions are you running? Might be related to a change there and something we need to address (feel free to make a github issue if you can do a small reproduction somewhere)
FFhd12/20/2023
node is 20 typescript , 5.3.3 on doing some searching found that typescript after some 4.2.4 version introduced some change related to this, idk have any idea, but giving as much details i can
Nnlucas12/20/2023
Yeah it would have to be far more recent, or some flag you’ve got switched on in tsconfig that we aren’t aware of Those are quite new versions so it’s possible something has changed
FFhd12/20/2023
that to i know of, tsconfig has been same since my last push but what instead i have done is just made a seperate trpc package outside my api package (which just had enpoint logics) i raised the issue on trpc repository
Nnlucas12/20/2023
Thanks, we’ll be able to to take a look at that repro and hopefully come up with a solution or documentation. if you have a workaround for now that’s great though
Nnlucas12/20/2023
Ah that might be it, just threw that in the core chat
No description
FFhd12/20/2023
oh shi-, that did fixed it, thanks it literally saved me several hours of works finding work around and module argumenting this should i close that issue or comment there that person should have noImplicitOverride field should not be set to true in their tsconfig unless then are using ts version <=4.2
Nnlucas12/20/2023
Please do add the solution to the issue, it will help future people 🙂 Feel free to close if you’re happy it’s resolved. Might be something we could support properly though
Kkamilogorek12/20/2023
tRPC requires at least TypeScript v4.7, so you can also send a PR that'll update all overrides 🙂 this way you, and other people can keep using this config setting It's TRPCError and TRPCClientError only from what I see that need to be updated
FFhd12/20/2023
yeah i would be very happy to fix this by raising a pr, okay on it
FFhd12/20/2023
hey @kamilogorek , sorry for tagging you, i had a doubt, on adding override on my codebase in trpc/server node_modules, i am not getting error during build (basically fix the issue), but i am getting this red error that, i can't use override keyword because there is no field named cause in Error class as you can see, but , my app is using lib.es5.d.ts but the trpc i cloned was using the lib.es2022.d.ts which did not give this error just wanted to make sure if this has nothing to do,
No description
Kkamilogorek12/20/2023
Casue requires indeed es2022 to be recognized, so you’ll be fine 🙂
FFhd12/20/2023
got it 👍 , thanks for your time i raised the pr, please let me know if there is something..

Looking for more? Join the community!

Recommended Posts
Why do people use SplitLink? (http + websocket)Why not just use websockets for everything? Just curious.Force user to loginHow can I redirect the user to "/login" if the user are not logged in?TRPC with middly middleware on lambdaHello, has anyone used middly middleware on AWS lambda? Thanks!tRPC on Vercel Serverless without Next?I would love to be able to use tRPC in a vercel serverless context, but not in a Next app – just theUsage with zod-validation-errorHas anyone tried using trpc with https://www.npmjs.com/package/zod-validation-error ?Errors while running mutations when deploying CT3A using SSTI'm currently migrating a NextJS project of mine from Vercel to SST. It's based of CT3A and the trpcKeep suspense on SSRI'm currently trying to perform a trpc query in Nextjs with React suspense, however, I only want theHow to properly type function arguments for procedures?I'm using tRPC 10 with `trpc/react-query` I'm trying to understand how to create a function that reHow Do I Ban Users & Invalidate Their JWT Tokens?When a malicious user gets banned by an admin, I have to ensure he no longer can access protected rouseQuery first refetch returns undefinedHello. So, I'm trying to get an item by ID when the user clicks a button. I've searched around and f❌ Failed to collect page data for api trpc [trpc] ❌I'm getting this error when I deploy to Vercel Framework: NEXTJS Anyone resolved this issue 🤔, HELSSR with initialData throws errorI'm using SSR with Astro and have a client that looks like ```tsx export type TfdExampleGreet = RouHow to cache trpc server request next.js app routeris it the right way ctx.headers.set( "Cache-Control", "public, max-age=43200, stale-whileThe property '$request' in your router collides with a built-in methodHas anybody seen this error before? I cant make sense of itTrpc calls being uncessarily madeHi friends, i am relevatively new to TRPC so this could be somethign super basic. I have a componentGet Name of All Query Routes or Mutation RoutesTypescript is pretty unhappy with my methods of doing this manually, so wondering if there are any oLosing Types in VSCodeI'm encountering a curious issue with type inference in my project and wondering if anyone else has useUtils vs useQueryClientI'm trying to use the `useUtils` hook but I'm unsure if I'm doing it correctly? It doesn't seem to wErrors serializationAre the errors now using the transformer serialize? or the errors simply go through errorsTransformeBuild error with trpc-panelHi. I'm having a trouble building my tRPC api with trpc-panel. I'm using yarn workspaces and trying