\n\n\n\n### Link to reproduction\n\nNot Needed\n\n### To reproduce\n\nfetch an query on the server and the error type is messed up\n\n### Additional information\n\n_No response_\n\n### 👨👧👦 Contributing\n\n- [ ] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[3181],{"name":3182,"color":3183},"🐛 bug: unconfirmed","e99695",6956,"bug: since TRPC v11.5.0 errors on createTRPCOptionsProxy are broken and not typed properly","2025-09-22T23:38:43Z","https://github.com/trpc/trpc/issues/6956",0.6826867,{"description":3190,"labels":3191,"number":3193,"owner":3172,"repository":3172,"state":3173,"title":3194,"updated_at":3195,"url":3196,"score":3197},"### Provide environment information\n\n```\r\n System:\r\n OS: macOS 14.4.1\r\n CPU: (8) arm64 Apple M1\r\n Memory: 62.41 MB / 16.00 GB\r\n Shell: 5.9 - /bin/zsh\r\n Binaries:\r\n Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node\r\n npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm\r\n pnpm: 9.12.2 - ~/.nvm/versions/node/v20.10.0/bin/pnpm\r\n Browsers:\r\n Chrome: 130.0.6723.92\r\n Safari: 17.4.1\r\n npmPackages:\r\n @tanstack/react-query: ^5.59.19 => 5.59.19 \r\n @trpc/client: 11.0.0-rc.608 => 11.0.0-rc.608+f75de97b3 \r\n @trpc/react-query: 11.0.0-rc.608 => 11.0.0-rc.608+f75de97b3 \r\n react: ^18.3.1 => 18.3.1 \r\n typescript: ^5.6.3 => 5.6.3 \r\n```\n\n### Describe the bug\n\nI have a query which I just want to run in a certain condition (if another query had a non-empty result). I was trying to follow the docs (see https://trpc.io/docs/client/react/useQueries in conjunction with https://tanstack.com/query/v4/docs/framework/react/guides/dependent-queries#usequeries-dependent-query) but I could not get my code snippet to compile.\n\n### Link to reproduction\n\nhttps://stackblitz.com/edit/github-qa2kdy?file=src%2Fpages%2Findex.tsx\n\n### To reproduce\n\nChange the text in the variable `text` in line 10 of the `index.tsx`, and you'll see the error appear. To me the error only appeared after changing the text.\n\n### Additional information\n\nHere's the typescript error I get on the callback:\r\n\r\n```\r\nArgument of type '(t: UseQueriesProcedureRecord\u003C{ ctx: object; meta: object; errorShape: DefaultErrorShape; transformer: false; }, { greeting: QueryProcedure\u003C{ input: { name?: string | null | undefined; }; output: { text: string; }; }>; }>) => [] | [...]' is not assignable to parameter of type '(t: UseQueriesProcedureRecord\u003C{ ctx: object; meta: object; errorShape: DefaultErrorShape; transformer: false; }, { greeting: QueryProcedure\u003C{ input: { name?: string | null | undefined; }; output: { text: string; }; }>; }>) => readonly []'.\r\n Type '[] | [TrpcQueryOptionsForUseQueries\u003C{ text: string; }, { text: string; }, TRPCClientError\u003C{ ctx: object; meta: object; errorShape: DefaultErrorShape; transformer: false; }>>]' is not assignable to type 'readonly []'.\r\n Type '[TrpcQueryOptionsForUseQueries\u003C{ text: string; }, { text: string; }, TRPCClientError\u003C{ ctx: object; meta: object; errorShape: DefaultErrorShape; transformer: false; }>>]' is not assignable to type 'readonly []'.\r\n Source has 1 element(s) but target allows only 0.(2345)\r\n```\n\n### 👨👧👦 Contributing\n\n- [ ] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[3192],{"name":3182,"color":3183},6188,"bug: React: Types for callback of `trpc.useQueries` doesn't allow returning an empty array","2025-03-20T15:42:41Z","https://github.com/trpc/trpc/issues/6188",0.6834945,{"description":3199,"labels":3200,"number":3202,"owner":3172,"repository":3172,"state":3173,"title":3203,"updated_at":3204,"url":3205,"score":3206},"### Provide environment information\n\n``` \nSystem:\n OS: macOS 14.5\n CPU: (12) arm64 Apple M2 Max\n Memory: 73.41 MB / 32.00 GB\n Shell: 5.9 - /bin/zsh\n Binaries:\n Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node\n Yarn: 1.22.22 - ~/Library/pnpm/yarn\n npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm\n Browsers:\n Chrome: 135.0.7049.117\n Edge: 134.0.3124.62\n Safari: 17.5\n npmPackages:\n @trpc/server: ^11.1.2 => 11.1.2 \n typescript: ^5.8.3 => 5.8.3 \n```\n\n### Describe the bug\n\nWhen using the documented pattern for defining a router (verbatim from https://trpc.io/docs/server/routers), TypeScript emits declaration files that include imports from `@trpc/server/dist/unstable-core-do-not-import`, which is not exposed via the package’s exports field.\n\nThis makes the generated `.d.ts` files invalid for consumers that rely on strict ESM resolution, including build tools and downstream libraries.\n\n### Link to reproduction\n\nhttps://github.com/extradosages/trpc-type-leak-demo\n\n### To reproduce\n\nUse the following `trpc.ts` and `router.ts` files (copied verbatim from the docs):\n\n`trcp.ts`\n```ts\nimport { initTRPC } from '@trpc/server';\nconst t = initTRPC.create();\nexport const router = t.router;\nexport const publicProcedure = t.procedure;\n```\n\n`router.ts`\n```ts\nimport { publicProcedure, router } from './trpc';\nconst appRouter = router({\n greeting: publicProcedure.query(() => 'hello tRPC v10!'),\n});\nexport type AppRouter = typeof appRouter;\n```\n\nRun:\n```bash\ntsc --emitDeclarationOnly\n```\n\nObserve that `router.d.ts` includes:\n```ts\ndeclare const appRouter: import(\"@trpc/server/dist/unstable-core-do-not-import\").BuiltRouter\u003C...>;\n```\n\nCompare to the `package.json` `exports` field:\n```json\n\"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n ...\n },\n ...\n \"./unstable-core-do-not-import\": {\n \"import\": \"./dist/unstable-core-do-not-import.mjs\",\n ...\n }\n}\n```\n\n### Additional information\n\nMight be solved by https://github.com/trpc/trpc/issues/5004.\n\nCurrently running a workaround in production with the following patch:\n```diff\ndiff --git a/package.json b/package.json\nindex 1f03d01bd1148bffc1434ac66f9feb52ba654bc3..f73cdbd446c2421a377af8ce0459288e1ee1162b 100644\n--- a/package.json\n+++ b/package.json\n@@ -73,6 +73,11 @@\n \"require\": \"./dist/adapters/ws.js\",\n \"default\": \"./dist/adapters/ws.js\"\n },\n+ \"./dist/*\": {\n+ \"import\": \"./dist/*\",\n+ \"require\": \"./dist/*\",\n+ \"default\": \"./dist/*\"\n+ },\n \"./http\": {\n \"import\": \"./dist/http.mjs\",\n \"require\": \"./dist/http.js\",\n```\n\n### 👨👧👦 Contributing\n\n- [ ] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[3201],{"name":3182,"color":3183},6753,"bug: generated `.d.ts` files leaking un-exported types","2025-05-07T23:42:57Z","https://github.com/trpc/trpc/issues/6753",0.68434227,{"description":3208,"labels":3209,"number":3210,"owner":3172,"repository":3211,"state":3173,"title":3212,"updated_at":3213,"url":3214,"score":3215},"The typescript doesn't compile with the upgrade of trpc-openapi spec, errors out with:\r\n\r\n```\r\nproject-name:build: ../../node_modules/@trpc/server/src/error/TRPCError.ts(23,19): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'Error'.\r\nproject-name:build: ../../node_modules/@trpc/server/src/core/internals/config.ts(19,10): error TS2304: Cannot find name 'window'.\r\nproject-name:build: ../../node_modules/@trpc/server/src/core/internals/config.ts(20,13): error TS2304: Cannot find name 'window'.\r\n```\r\n\r\n\r\nThe Project is having the following dependency versions:\r\n```\r\n\"@trpc/client\": \"^10.25.1\",\r\n\"@trpc/server\": \"^10.25.1\",\r\n\"trpc-openapi\": \"^1.2.0\",\r\n\"zod\": \"^3.20.2\",\r\n```\r\n\r\n`tfconfig.json`:\r\n```\r\n{\r\n \"compilerOptions\": {\r\n \"rootDir\": \"src\",\r\n \"outDir\": \"dist\",\r\n \"target\": \"es2022\",\r\n \"module\": \"NodeNext\",\r\n \"lib\": [\"es2022\"],\r\n \"moduleResolution\": \"Node\",\r\n \"skipLibCheck\": true,\r\n \"esModuleInterop\": true,\r\n \"strict\": true,\r\n \"noImplicitOverride\": true,\r\n \"sourceMap\": true,\r\n \"declaration\": true,\r\n \"declarationMap\": true\r\n }\r\n}\r\n```\r\n\r\n\r\nI have confirmed the project works fine with v1.1.2.",[],335,"trpc-openapi","Compilation fails with v1.2.0","2023-12-24T15:04:32Z","https://github.com/trpc/trpc-openapi/issues/335",0.68531173,{"description":3217,"labels":3218,"number":3222,"owner":3172,"repository":3172,"state":3223,"title":3224,"updated_at":3225,"url":3226,"score":3227},"### Provide environment information\r\n\r\n```\r\nSystem:\r\n OS: macOS 13.2.1\r\n CPU: (10) arm64 Apple M1 Max\r\n Memory: 3.48 GB / 32.00 GB\r\n Shell: 5.8.1 - /bin/zsh\r\n Binaries:\r\n Node: 19.8.1 - ~/.asdf/installs/nodejs/19.8.1/bin/node\r\n Yarn: 1.22.19 - ~/.asdf/installs/nodejs/19.8.1/bin/yarn\r\n npm: 9.5.1 - ~/.asdf/plugins/nodejs/shims/npm\r\n Browsers:\r\n Brave Browser: 113.1.51.114\r\n Safari: 16.3\r\n npmPackages:\r\n @trpc/server: ^10.28.0 => 10.28.0\r\n react: ^18.2.0 => 18.2.0\r\n typescript: ^5.0.4 => 5.0.4\r\n```\r\n\r\n### Describe the bug\r\n\r\n```\r\nnode_modules/.pnpm/@trpc+server@10.28.0/node_modules/@trpc/server/src/core/internals/procedureBuilder.ts:404:20 - error TS2339: Property 'error' does not exist on type 'MiddlewareResult\u003Cany>'.\r\n Property 'error' does not exist on type 'MiddlewareOKResult\u003Cany>'.\r\n\r\n404 throw result.error;\r\n```\r\n\r\n```\r\nnode_modules/.pnpm/@trpc+server@10.28.0/node_modules/@trpc/server/src/deprecated/internals/procedure.ts:244:20 - error TS2339: Property 'error' does not exist on type 'MiddlewareResult\u003Cany>'.\r\n Property 'error' does not exist on type 'MiddlewareOKResult\u003Cany>'.\r\n\r\n244 throw result.error;\r\n```\r\n\r\n### To reproduce\r\n\r\nWhen trying to build via `tsc`, I receive the following error: `Property 'error' does not exist on type 'MiddlewareOKResult\u003Cany>'.`\r\n\r\n### Additional information\r\nAdding `\"skipLibCheck\": true,` doesn't work.\r\n\r\n_No response_\r\n\r\n### 👨👧👦 Contributing\r\n\r\n- [X] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!\r\n\r\n\r\n\n\n\u003Csub>[T-80](https://linear.app/trpc/issue/T-80/bug-ts2339-error-on-middlewareokresultany)\u003C/sub>",[3219],{"name":3220,"color":3221},"⏮ needs reproduction","000055",4426,"closed","bug: TS2339 error on MiddlewareOKResult\u003Cany>","2023-06-14T18:01:59Z","https://github.com/trpc/trpc/issues/4426",0.60891193,{"description":3229,"labels":3230,"number":3234,"owner":3172,"repository":3172,"state":3223,"title":3235,"updated_at":3236,"url":3237,"score":3238},"Hi there,\r\n\r\nfirst of all: Thanks a lot for creating trpc :) I just recently stumpled upon it and I'm quite enthusiastic about it's design.\r\n\r\nNow to the problem:\r\n\r\nI'm trying to use trpc in a pnpm-driven monorepo. When I try to compile the package that's using trpc (both `@trpc/server` and `@trpc/client`), `tsc` fails with:\r\n\r\n```\r\n../../../../node_modules/.pnpm/@trpc+server@9.23.4/node_modules/@trpc/server/dist/declarations/src/adapters/node-http/types.d.ts:3:16 - error TS2307: Cannot find module 'qs' or its corresponding type declarations.\r\n\r\n3 import qs from 'qs';\r\n\r\n[...]\r\n\r\n../../../../node_modules/.pnpm/@trpc+server@9.23.4/node_modules/@trpc/server/dist/declarations/src/adapters/standalone.d.ts:5:107 - error TS2344: Type 'IncomingMessage' does not satisfy the constraint 'NodeHTTPRequest'.\r\n Type 'IncomingMessage' is not assignable to type '{ method?: string; query?: any; body?: unknown; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.\r\n Types of property 'method' are incompatible.\r\n Type 'string | undefined' is not assignable to type 'string'.\r\n Type 'undefined' is not assignable to type 'string'.\r\n\r\n5 export declare type CreateHTTPHandlerOptions\u003CTRouter extends AnyRouter> = NodeHTTPHandlerOptions\u003CTRouter, http.IncomingMessage, http.ServerResponse>;\r\n```\r\n\r\nThe first one\r\n```\r\nTS2307: Cannot find module 'qs' or its corresponding type declarations.\r\n```\r\n\r\ncan be fixed by installing `@types/qs`. However, I don't think that should be necessary.\r\n\r\nThe second one\r\n```\r\nTS2344: Type 'IncomingMessage' does not satisfy the constraint 'NodeHTTPRequest'.\r\n```\r\nisn't explicable to me but at least resembles one of the errors documented in #1022.\r\n\r\nThis issue was closed by #1151, which should be included with the trpc version I'm using (9.23.4).\r\n\r\nIt's possible that this is related to my use of pnpm.\r\n\r\nAny hint would be appreciated :) I'll keep you posted, if I find anything myself.",[3231],{"name":3232,"color":3233},"🐛 bug","d73a4a",1904,"Type Errors","2022-10-04T12:02:52Z","https://github.com/trpc/trpc/issues/1904",0.60990864,{"description":3240,"labels":3241,"number":3242,"owner":3172,"repository":3172,"state":3223,"title":3243,"updated_at":3244,"url":3245,"score":3246},"Hi @KATT, \r\nThank you for this great library. \r\n\r\nI am reporting that the server types need updates after the latest typescript release (4.6): \r\n\r\n```bash\r\nnode_modules/@trpc/server/dist/declarations/src/TRPCError.d.ts:7:14 - error TS2416: Property 'cause' in type 'TRPCError' is not assignable to the same property in base type 'Error'.\r\n Type 'unknown' is not assignable to type 'Error | undefined'.\r\n\r\n7 readonly cause?: unknown;\r\n ~~~~~\r\n\r\n\r\nFound 1 error in node_modules/@trpc/server/dist/declarations/src/TRPCError.d.ts:7\r\n```\r\n\r\n\r\n\r\nBest regards \r\n",[],1588,"Type error in @trpc/server with TS 4.6","2022-10-04T12:03:04Z","https://github.com/trpc/trpc/issues/1588",0.6420751,{"description":3248,"labels":3249,"number":3259,"owner":3172,"repository":3172,"state":3223,"title":3260,"updated_at":3261,"url":3262,"score":3263},"While working on a project with tRPC (based on the `fastify-server` example), I came across a type error while attempting to build the project.\r\n```\r\nnode_modules/@trpc/client/dist/declarations/src/TRPCClientError.d.ts:13:14 - error TS2416: Property 'cause' in type 'TRPCClientError\u003CTRouter>' is not assignable to the same property in base type 'Error'.\r\n Type 'Maybe\u003CError>' is not assignable to type 'Error | undefined'.\r\n Type 'null' is not assignable to type 'Error | undefined'.\r\n\r\n13 readonly cause: Maybe\u003CError>;\r\n ~~~~~\r\n\r\nnode_modules/@trpc/server/dist/declarations/src/TRPCError.d.ts:7:14 - error TS2416: Property 'cause' in type 'TRPCError' is not assignable to the same property in base type 'Error'.\r\n Type 'unknown' is not assignable to type 'Error | undefined'.\r\n\r\n7 readonly cause?: unknown;\r\n ~~~~~\r\n``` \r\n \r\nI managed to figure out what causes the bug: There is a breaking change in `typescript@4.6.2`, [this one](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-6.html#object-rests-drop-unspreadable-members-from-generic-objects) I believe \r\nThrough more testing, I also figured out a few workarounds: \r\n- Use `typescript@4.5.5`\r\n- Set the `target` in `tsconfig.json` to `ES2021`\r\n- Set the `target` in `tsconfig.json` to `ES6` \r\n \r\nI was going to file a PR, but then I wasn't sure exactly what needs to be fixed(?). Is this a bug that needs fixing within tRPC itself? Should there be a warning in the docs? Should the examples use the aforementioned `tsconfig` workaround? Should the entire repo use the `tsconfig` workaround? \r\n \r\nI am very willing to help with a fix but I need some insight. ",[3250,3253,3256],{"name":3251,"color":3252},"@trpc/server","9BE78E",{"name":3254,"color":3255},"@trpc/client","6095C2",{"name":3257,"color":3258},"🔎 needs more investigation/info","d4c5f9",2292,"Potential for future type error in TRPCError & TRPCClientError","2022-09-29T21:24:11Z","https://github.com/trpc/trpc/issues/2292",0.6453434,{"description":3265,"labels":3266,"number":3267,"owner":3172,"repository":3172,"state":3223,"title":3268,"updated_at":3269,"url":3270,"score":3271},"We are still seeing this issue https://github.com/trpc/trpc/issues/2292:\r\n\r\n```\r\nnode_modules/@trpc/client/src/TRPCClientError.ts:18:19 - error TS2416: Property 'cause' in type 'TRPCClientError\u003CTRouter>' is not assignable to the same property in base type 'Error'.\r\n Type 'Maybe\u003CError>' is not assignable to type 'Error | undefined'.\r\n Type 'null' is not assignable to type 'Error | undefined'.\r\n\r\n18 public readonly cause;\r\n```\r\n\r\nWith the following deps:\r\n\r\n```\r\n \"typescript\": \"4.8.4\",\r\n \"@trpc/client\": \"9.27.2\",\r\n \"@trpc/react\": \"9.27.2\",\r\n \"@trpc/server\": \"9.27.2\",\r\n```\r\n\r\n_Originally posted by @moltar in https://github.com/trpc/trpc/issues/2292#issuecomment-1262366016_\r\n ",[],2851,"Type error with TRPCError & TRPCClientError","2022-10-14T06:21:43Z","https://github.com/trpc/trpc/issues/2851",0.6465871,["Reactive",3273],{},["Set"],["ShallowReactive",3276],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fmAZd0NZQEvCUXkukKyg9XHbYCh2UMz2D9ac5QIvwk4U":-1},"/trpc/trpc-openapi/322"]