segment_treeS
tRPC2y ago
41 replies
segment_tree

The inferred type of 'trpc' cannot be named without a reference to '...'

I have a monorepo setup like this:

root
-tsconfig.json
-frontend
--tsconfig.json
-backend
--tsconfig.json

I added a reference in the client tsconfig:

  "references": [
    {
      "path": "../backend"
    }
  ],


I added "composite": true to my backend tsconfig.

In my root tsconfig, I have:

{
  "references": [
    {
      "path": "./backend"
    },
    {
      "path": "./frontend"
    }
  ],
  "files": [],
  "include": [],
  "exclude": ["**/node_modules"]
}


However, now in my client, when I create my trpc instance:

export const trpc = createTRPCReact<AppRouter>();

I get a bunch of typing errors:

The inferred type of 'trpc' cannot be named without a reference to '../../../backend/node_modules/.prisma/client'. This is likely not portable. A type annotation is necessary.ts(2742)
The inferred type of 'trpc' cannot be named without a reference to '../../../backend/node_modules/@types/express'. This is likely not portable. A type annotation is necessary.ts(2742)


Where is this coming from and how can I fix it?
Was this page helpful?