TS4111: Property 'error' comes from an index signature, so it must be accessed with ['error'].

I am trying to use trpc with AnalogJs, an Angular meta framework and Nx. We use the @nx/vite builder to build our application. While development works perfectly, I am running into the following errors when building the application:
> nx run test:build:production

node_modules/@trpc/client/src/TRPCClientError.ts:42:18 - error TS4111: Property 'error' comes from an index signature, so it must be accessed with ['error'].

40 | return (
41 | isObject(obj) &&
> 42 | isObject(obj.error) &&
| ^
43 | typeof obj.error.code === 'number' &&
44 | typeof obj.error.message === 'string'
45 | );

...
> nx run test:build:production

node_modules/@trpc/client/src/TRPCClientError.ts:42:18 - error TS4111: Property 'error' comes from an index signature, so it must be accessed with ['error'].

40 | return (
41 | isObject(obj) &&
> 42 | isObject(obj.error) &&
| ^
43 | typeof obj.error.code === 'number' &&
44 | typeof obj.error.message === 'string'
45 | );

...
The issue stems from the @nx/vite builder analyzing the .ts files inside @trpc/client/src and @trpc/server/src folders of my node_modules. I was wondering why those src directories and the .ts files are included and if you are aware of any issues with React, Nx, and Vite? Thanks already!
Nick
Nick209d ago
Sounds like a project config issue, check your tsconfig is excluding node_modules and see if skipLibCheck is the cause. I believe the latter shouldn’t be a problem as they recommend that stays on I think
goetzrobin
goetzrobin208d ago
From what I understand skipLibCheck works by checking .d.ts files, not .ts files. I will check my config and see why the .ts files from the node_modules are considered. Can you help me understand why they are included? I am just curious what the reason for that is Also, thanks for responding so quickly! And awesome work with tRPC! I am very excited to continue to use it
Nick
Nick208d ago
Not really sure what could be going on here, I'm not an expert in bundling and tooling Your node_modules should definitely not be having any .ts files checked, it smells like a tsconfig problem
More Posts
TypeError: Cannot read properties of null (reading '_def')As the title says, I get the following: TypeError: Cannot read properties of null (reading '_def') I wanna add a localStorage persister, but I'm getting errors for hydration:I wanna add a localStorage persister, but I'm getting errors for hydration: ```js const persister =error route always getting 500 from trpc error? (next13/approuter)I've got this condition for throwing in my trpc procedure: ```ts if (!userClerkProfile) { force-cache planetscale errortrying to use the trpc API from RSCs fails and gives the following error ```log result: { data:What is the pattern for unsubscribing from a subscription?Hi there! I'd like to prevent unnecessary connections to a websocket server across multiple renders.How to add a short delay between requestsEnvironment: nextjs 13, node 18, npm, trpc 10.9.0 I'm wondering if it's possible to add a short delGlobal metadata / filters: Re-validate all queriesHi all, Simple question, I'm looking for the most efficient way to add some global state to all queAttempted import error: 'hashQueryKey' is not exported from '@tanstack/react-query' issuei'm getting this error while trying trpc with latest next version , i tried downgrading but got anotTRPC cant handle ErrorHi, can someone please help me: https://stackoverflow.com/questions/77333318/trpc-handle-trpcerrorI want to create a wrapper for TRPC.init but I can't seem to get the context type correct.I want to get wrap trpc.initTrouble getting a TRPC client in Astro SSR pages, instead I get a noopI'd like to add TRPC to an Astro site. I have an SSR route here (https://github.com/aisflat439/anothWhy webhooks does not work with TRPC?I have a what suppose to be a webhook: ``` deposit: publicProcedure.input(z.any()).mutation(asynctRPC set up errorHey guys, I've been trying to set up tRPC, but unfortunatyy getting this error and it is really unclVercel maxDuration with tRPCHow do you extend extend tRPC timeouts on Vercel? I tried this in `vercel.json`: ```json { "funct