jgouxJ
tRPCβ€’3y agoβ€’
23 replies
jgoux

Am I the only one struggling with pnpm + TypeScript monorepo + trpc?

Hello all,

When using pnpm in a TypeScript monorepo without node-linker, I hit those errors:

web/src/lib/trpc.tsx:7:14 - error TS2742: The inferred type of 'trpc' cannot be named without a reference to '../../../api/node_modules/@snaplet/sdk/src'. This is likely not portable. A type annotation is necessary.

7 export const trpc = createReactQueryHooks<WebRouter>()


Types sharing between packages when using pnpm + TypeScript is quite broken, and I'm not sure what's the best move to solve it. Ideally I shouldn't have to alter my compilerOptions.paths, or install extra deps in the root. πŸ˜…

I opened a discussion about it here if you want to participate: https://github.com/orgs/pnpm/discussions/6367
Was this page helpful?