goetzrobinG

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 |   );

...


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!
Was this page helpful?