\n\n### Link to reproduction\n\nhttps://github.com/brandongit2/trpc-tanstack-router-bug-repro/blob/main/index.ts\n\n### To reproduce\n\n1. Clone the repro repo\n2. `pnpm install`\n3. Open `index.ts`\n4. Type error:\n ```ts\n Type 'QueryClient' is not assignable to type 'QueryClient | (() => QueryClient)'.\n Type 'import(\"/Users/brandontsang/projects/trpc-tanstack-router-bug-repro/node_modules/.pnpm/@tanstack+query-core@5.66.4/node_modules/@tanstack/query-core/build/modern/hydration-k2LfsAVL\", { with: { \"resolution-mode\": \"import\" } }).b' is not assignable to type 'import(\"/Users/brandontsang/projects/trpc-tanstack-router-bug-repro/node_modules/.pnpm/@tanstack+query-core@5.66.4/node_modules/@tanstack/query-core/build/modern/hydration-BHYO6Wdv\").b'.\n Property '#private' in type 'QueryClient' refers to a different member that cannot be accessed from within type 'QueryClient'.\n ```\n\n### Additional information\n\nThis comes from the fact that `@trpc/tanstack-react-query` doesn't have dedicated ESM type exports.\n\n- In my repro, I have:\n - `\"type\": \"module\"` in `package.json`\n - `\"moduleResolution\": \"nodenext\"` in my `tsconfig.json`\n- When I import from `@tanstack/react-query`, the `.d.ts` files are interpereted as ESM by TypeScript, since they have dedicated ESM type declarations:\n - \u003Cimg width=\"300\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/02697f38-cd10-45ba-b0e3-380b3a7cf568\" />\n- But when I import from `@trpc/tanstack-react-query`, the `.d.ts` files are interpereted as CJS by TypeScript, since the `package.json` doesn't specify `\"type\"`.\n- When `@trpc/tanstack-react-query`'s types import `@tanstack/react-query`, they come in as CJS types. `@tanstack/react-query`'s ESM and CJS types don't seem to be compatible with one another.\n\nIt could be argued that this is also a TanStack Query bug, since their ESM and CJS types ought to be compatible with one another anyway.\n\n---\n\n### Workarounds/fixes:\n\n1. Patch `@trpc/tanstack-react-query` to force ESM imports:\n - Find the `.d.ts` file that imports `@tanstack/react-query` (in this repro's case, it's `@trpc/tanstack-react-query/dist/internals/createOptionsProxy.d.ts`)\n - add an import attribute: `...from '@tanstack/react-query' with {'resolution-mode': 'import'}`\n - Type error gone!\n2. Or, in the user's project, import `@tanstack/react-query` as CJS and override the type:\n - \u003Cimg width=\"951\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/2bc65705-b4b9-45bd-bdf7-6213bebedee2\" />\n - Type error gone!\n\n### ๐จโ๐งโ๐ฆ Contributing\n\n- [ ] ๐โโ๏ธ Yes, I'd be down to file a PR fixing this bug!",[2867,2870],{"name":2868,"color":2869},"๐ bug","d73a4a",{"name":2871,"color":2872},"๐โโ๏ธ help wanted","008672",6554,"trpc","open","bug: Type incompatibility between `@trpc/tanstack-react-query` and `@tanstack/react-query`","2025-03-01T23:59:14Z","https://github.com/trpc/trpc/issues/6554",0.73736596,{"description":2881,"labels":2882,"number":2883,"owner":2874,"repository":2884,"state":2885,"title":2886,"updated_at":2887,"url":2888,"score":2889},"./src/pages/api/[...trpc].ts:6:1\r\nType error: The inferred type of 'default' cannot be named without a reference to '.pnpm/next@12.2.0_beenoklgwfttvph5dgxj7na7aq/node_modules/next'. This is likely not portable. A type annotation is necessary.\r\n\r\n 4 | \r\n 5 | // Handle incoming OpenAPI requests\r\n 6 | export default createOpenApiNextHandler({\r\n | ^\r\n 7 | router: appRouter,\r\n 8 | createContext,\r\n 9 | });\r\n\r\n",[],56,"trpc-openapi","closed","[Example NextJS] The inferred type of 'default' cannot be named without a reference","2022-07-11T15:01:19Z","https://github.com/trpc/trpc-openapi/issues/56",0.59490633,{"description":2891,"labels":2892,"number":2893,"owner":2874,"repository":2874,"state":2885,"title":2894,"updated_at":2895,"url":2896,"score":2897},"### Provide environment information\r\n\r\n```\r\n System:\r\n OS: macOS 12.5.1\r\n CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz\r\n Memory: 6.09 GB / 32.00 GB\r\n Shell: 5.8.1 - /bin/zsh\r\n Binaries:\r\n Node: 18.8.0 - ~/.volta/tools/image/node/18.8.0/bin/node\r\n Yarn: 1.22.17 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn\r\n npm: 8.18.0 - ~/.volta/tools/image/node/18.8.0/bin/npm\r\n Browsers:\r\n Edge: 105.0.1343.33\r\n Firefox: 95.0.2\r\n Safari: 15.6.1\r\n npmPackages:\r\n @trpc/server: 10.0.0-proxy-alpha.76 => 10.0.0-proxy-alpha.76 \r\n```\r\n\r\n### Describe the bug\r\n\r\nI have good reason to believe the following issue is back (search issue history to see previous fixes) with trpc version 10:\r\n\r\n`The inferred type of 'appRouter' cannot be named without a reference to '../../node_modules/@trpc/server/dist/error/formatter.js'. This is likely not portable. A type annotation is necessary.` Also occurs with `'../../node_modules/@trpc/server/dist/core/internals/utils.js'`.\r\n\r\n#1960 fixed this before, is it possible that the same bug has presented again?\r\n\r\n### To reproduce\r\n\r\nWith an esm module, try to use trpc 10. _More specifically, set up a router with routes in the new trpc10 style_. Also, is `composite: true` required with trpc? I couldn't infer types from the client without this set, and without a `\"references\": [{ \"path\": \"../bff\" }],` in the client tsconfig.json.\r\n\r\ntsconfig.json (server):\r\n\r\n```\r\n{\r\n \"compilerOptions\": {\r\n \"skipLibCheck\": true,\r\n \"composite\": true,\r\n \"module\": \"ESNext\",\r\n \"moduleResolution\": \"Node16\",\r\n \"sourceMap\": true,\r\n \"outDir\": \"./dist\",\r\n \"pretty\": true,\r\n \"strict\": true,\r\n \"noUnusedParameters\": true,\r\n \"removeComments\": true,\r\n \"noImplicitReturns\": true,\r\n \"allowSyntheticDefaultImports\": true,\r\n \"esModuleInterop\": true,\r\n \"experimentalDecorators\": true,\r\n \"resolveJsonModule\": true,\r\n \"declaration\": true,\r\n \"declarationMap\": true,\r\n \"rootDir\": \"src\",\r\n \"baseUrl\": \".\",\r\n \"paths\": {\r\n \"@/*\": [\"./src/*\"],\r\n },\r\n },\r\n \"include\": [\r\n \"./src/**/*.ts\"\r\n ],\r\n}\r\n```\r\n\r\n### Additional information\r\n\r\nI've tried the fix in \"paths\", and it doesn't work for me.\r\n\r\n### ๐จโ๐งโ๐ฆ Contributing\r\n\r\n- [ ] ๐โโ๏ธ Yes, I'd be down to file a PR fixing this bug!",[],2717,"bug: The inferred type of 'appRouter' cannot be named without a reference to '../../node_modules/@trpc/server/dist/error/formatter.js'. This is likely not portable. A type annotation is necessary.","2022-10-04T00:17:44Z","https://github.com/trpc/trpc/issues/2717",0.67345786,{"description":2899,"labels":2900,"number":2901,"owner":2874,"repository":2874,"state":2885,"title":2902,"updated_at":2903,"url":2904,"score":2905},"### Provide environment information\r\n\r\nLocal machine:\r\n```\r\nenvinfo: command not found\r\n```\r\nยฏ\\\\\\_(ใ)\\_/ยฏ\r\n\r\nStackblitz repro:\r\n```\r\n System:\r\n OS: Linux 5.0 undefined\r\n CPU: (6) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz\r\n Memory: 0 Bytes / 0 Bytes\r\n Shell: 1.0 - /bin/jsh\r\n Binaries:\r\n Node: 16.14.2 - /usr/local/bin/node\r\n Yarn: 1.22.10 - /usr/local/bin/yarn\r\n npm: 7.17.0 - /usr/local/bin/npm\r\n npmPackages:\r\n @trpc/server: 10.0.0-proxy-beta.18 => 10.0.0-proxy-beta.18 \r\n typescript: ^4.8 => 4.8.4 \r\n```\r\n\r\n### Describe the bug\r\n\r\nUnder `\"moduleResolution\": \"Node16\"` (or `\"NodeNext\"`), compilation of TypeScript types for the router can fail with error\r\n```\r\nTS2742: The inferred type of 'appRouter' cannot be named without a reference to '../node_modules/@trpc/server/dist/core/internals/config.js'. This is likely not portable. A type annotation is necessary.\r\n```\r\n\r\n### Link to reproduction\r\n\r\nhttps://stackblitz.com/edit/trpc-server-inferred-type-cannot-be-named?file=src%2Findex.ts&view=editor\r\n\r\n### To reproduce\r\n\r\nSee repro:\r\n\r\n1. Set up package with Typescript\r\n2. Set `\"moduleResolution\": \"Node16\"`\r\n3. Try to compile types, e.g. via `tsc --declaration`\r\n\r\n### Additional information\r\n\r\nRelated issues:\r\n- #2717\r\n\r\nTried several suggested solutions (e.g. mentioned [here](https://github.com/microsoft/TypeScript/issues/42873#issuecomment-1140506416)); none worked, or had undesired side-effects.\r\n\r\nThe same issue exists in 9.x (after having manually worked around the module resolution).\r\n\r\n### ๐จโ๐งโ๐ฆ Contributing\r\n\r\n- [x] ๐โโ๏ธ Yes, I'd be down to file a PR fixing this bug!",[],2994,"bug: The inferred type of 'appRouter' cannot be named without a reference to ...","2022-10-28T12:02:38Z","https://github.com/trpc/trpc/issues/2994",0.69475627,{"description":2907,"labels":2908,"number":2909,"owner":2874,"repository":2874,"state":2885,"title":2910,"updated_at":2911,"url":2912,"score":2913},"I'm currently using Prisma with tRPC.io in a turborepo monorepo and I am seeing the following error on build:\r\n\r\n```\r\nThe inferred type of 'client' cannot be named without a reference to '../prisma/node_modules/@prisma/client/runtime'. This is likely not portable. A type annotation is necessary.\r\n```\r\n\r\n\u003Cimg width=\"1047\" alt=\"Screenshot 2022-07-19 at 16 44 01\" src=\"https://user-images.githubusercontent.com/84131395/179792636-ee6bcb19-5afb-4c23-a093-b36ae990cd6a.png\">\r\n\r\nI'm using version 9.26.2 on both @trpc/server and @trpc/client ...\r\n\r\nI have generated the prisma types ... but no luck, I still see this error on build.\r\n\r\nI can provide access to the monorepo in question for reference ... for a replication of the error.",[],2260,"The inferred type of 'client' cannot be named without a reference to '../prisma/node_modules/@prisma/client/runtime'","2022-07-19T15:50:09Z","https://github.com/trpc/trpc/issues/2260",0.6985607,{"description":2915,"labels":2916,"number":2923,"owner":2874,"repository":2874,"state":2885,"title":2924,"updated_at":2925,"url":2926,"score":2927},"### Provide environment information\n\n System:\r\n OS: macOS 13.0\r\n CPU: (8) x64 Apple M1\r\n Memory: 16.57 MB / 16.00 GB\r\n Shell: 5.5.1 - /usr/local/bin/zsh\r\n Binaries:\r\n Node: 14.18.3 - ~/.nvm/versions/node/v14.18.3/bin/node\r\n Yarn: 1.22.19 - ~/.nvm/versions/node/v14.18.3/bin/yarn\r\n npm: 8.13.1 - ~/.nvm/versions/node/v14.18.3/bin/npm\r\n Browsers:\r\n Brave Browser: 87.1.18.75\r\n Chrome: 107.0.5304.110\r\n Firefox: 105.0.3\r\n Firefox Developer Edition: 76.0\r\n Safari Technology Preview: 16.4\r\n\n\n### Describe the bug\n\n ERROR ERROR in client.ts:5:45 05:06:06\r\nTS2344: Type 'Router\u003C{ _config: RootConfig\u003C{ ctx: any; meta: {}; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>; router: true; ... 5 more ...; isDev: boolean; }> & { ...; }' does not satisfy the constraint 'Router\u003CAnyRouterDef\u003CAnyRootConfig, any>>'.\r\n The types returned by 'createCaller(...)' are incompatible between these types.\r\n Type '{ query: inferHandlerFn\u003C{}>; mutation: inferHandlerFn\u003C{}>; subscription: inferHandlerFn\u003C{}>; } & DecoratedProcedureRecord\u003C{ exportReport: BuildProcedure\u003C\"query\", { ...; }, { ...; }>; }>' is not assignable to type '{ query: inferHandlerFn\u003Cany>; mutation: inferHandlerFn\u003Cany>; subscription: inferHandlerFn\u003Cany>; } & DecoratedProcedureRecord\u003Cany>'.\r\n Type '{ query: inferHandlerFn\u003C{}>; mutation: inferHandlerFn\u003C{}>; subscription: inferHandlerFn\u003C{}>; } & DecoratedProcedureRecord\u003C{ exportReport: BuildProcedure\u003C\"query\", { ...; }, { ...; }>; }>' is not assignable to type '{ query: inferHandlerFn\u003Cany>; mutation: inferHandlerFn\u003Cany>; subscription: inferHandlerFn\u003Cany>; }'.\r\n Types of property 'query' are incompatible.\r\n Type 'inferHandlerFn\u003C{}>' is not assignable to type 'inferHandlerFn\u003Cany>'.\r\n Types of parameters 'path' and 'path' are incompatible.\r\n Type 'TPath' is not assignable to type 'never'.\r\n Type 'string' is not assignable to type 'never'.\n\n### Link to reproduction\n\nNo link\n\n### To reproduce\n\nI don't know why it stopped working all of a sudden\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!",[2917,2920],{"name":2918,"color":2919},"๐ป invalid","e4e669",{"name":2921,"color":2922},"โฎ needs reproduction","000055",3202,"bug: not sure what happened, just broke all of a sudden","2022-11-19T21:47:15Z","https://github.com/trpc/trpc/issues/3202",0.71647257,{"description":2929,"labels":2930,"number":2931,"owner":2874,"repository":2874,"state":2885,"title":2932,"updated_at":2933,"url":2934,"score":2935},"### Provide environment information\n\nSystem:\r\n OS: Windows 10 10.0.22621\r\n CPU: (16) x64 12th Gen Intel(R) Core(TM) i5-12600K\r\n Memory: 13.49 GB / 31.80 GB\r\n Binaries:\r\n Node: 18.12.1 - C:\\Program Files\\nodejs\\node.EXE\r\n Yarn: 3.4.1 - C:\\Program Files\\nodejs\\yarn.CMD\r\n npm: 9.2.0 - C:\\Program Files\\nodejs\\npm.CMD\r\n Browsers:\r\n Edge: Spartan (44.22621.1105.0), Chromium (109.0.1518.55)\r\n Internet Explorer: 11.0.22621.1\r\n npmPackages:\r\n @trpc/client: 10.11.1 => 10.11.1\r\n @trpc/react-query: 10.11.1 => 10.11.1\r\n @trpc/server: 10.11.1 => 10.11.1\r\n typescript: ^4.9.5 => 4.9.5\n\n### Describe the bug\n\nUnder `\"moduleResolution\": \"Node16\"` (or `\"NodeNext\"`), compilation of TypeScript types for the router can fail with error\r\n\r\n```\r\nThe inferred type of 'middleware' cannot be named without a reference to '../../node_modules/@trpc/server/dist/core/middleware.js'. This is likely not portable. A type annotation is necessary.ts(2742)\r\n```\n\n### Link to reproduction\n\nhttps://stackblitz.com/edit/trpc-export-ts2742\n\n### To reproduce\n\nSee repro:\r\n1. Set up package with Typescript\r\n2. Set \"moduleResolution\": \"Node16\"\r\n3. Try to compile types, e.g. via tsc --declaration\n\n### Additional information\n\nRelated issues:\r\n#1945, #2717, #2994\r\n\r\nThe issue with `mergeRouters` started in version `10.11.0` but can be worked around by explicitly typing the export.\r\n```typescript\r\nexport const mergeRouters = trpc.mergeRouters as \u003CTRouters extends AnyRouter[]>(...routerList: [...TRouters]) => MergeRouters\u003CTRouters>;\r\n```\r\n\r\nThe internal types for middleware are not all exported (and are significantly more complicated) so work arounds are aggressively hacky and unsustainable.\r\n\r\nOne additional note is although `router` and `procedure` can be exported here, using them in a generic way causes the same error.\n\n### ๐จโ๐งโ๐ฆ Contributing\n\n- [ ] ๐โโ๏ธ Yes, I'd be down to file a PR fixing this bug!",[],3786,"bug: [ESM] The inferred type of 'middleware'/'mergeRouters' cannot be named without a reference to...","2023-03-07T00:06:27Z","https://github.com/trpc/trpc/issues/3786",0.7178566,{"description":2937,"labels":2938,"number":2945,"owner":2874,"repository":2874,"state":2885,"title":2946,"updated_at":2947,"url":2948,"score":2949},"Hello all,\r\n\r\nI'm trying to set up a demo monorepo full ESM + TypeScript and I want to use trpc for the API part. ๐ \r\nI currently have an issue when generating declaration types for the project:\r\n\r\n```\r\nsrc/router.ts:6:14 - error TS2742: The inferred type of 'appRouter' cannot be named without a reference to '../../../node_modules/@trpc/server/dist/internals/procedure.js'. This is likely not portable. A type annotation is necessary.\r\n```\r\n\r\nRelated code is here: https://github.com/jgoux/acme/blob/main/apps/api/src/router.ts#L6\r\n\r\nTo reproduce run these commands:\r\n```bash\r\nyarn\r\nyarn workspace @acme/api build\r\n```\r\n\r\nNote that I'm using `@trpc/server@10.0.0-alpha.22`, the stable version wasn't correctly importable with ESM, discussion about it here: https://discord.com/channels/867764511159091230/894984069291581511/979830057994432522\r\n\r\nWhat's funny is that the `tsc --noEmit` is fine and doesn't report the error. ๐ \r\n\r\nI'm not sure what to do about this particular TS error, this is a new one to me. ๐ค ",[2939,2942],{"name":2940,"color":2941},"wontfix","ffffff",{"name":2943,"color":2944},"๐ needs more investigation/info","d4c5f9",1945,"Error TS2742 when generating declaration types with trpc.router","2022-10-04T06:08:55Z","https://github.com/trpc/trpc/issues/1945",0.7209185,{"description":2951,"labels":2952,"number":2955,"owner":2874,"repository":2874,"state":2885,"title":2956,"updated_at":2957,"url":2958,"score":2959},"### Provide environment information\r\n\r\n```\r\n System:\r\n OS: macOS 12.2.1\r\n CPU: (10) arm64 Apple M1 Pro\r\n Memory: 96.77 MB / 16.00 GB\r\n Shell: 5.8 - /bin/zsh\r\n Binaries:\r\n Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node\r\n npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm\r\n Browsers:\r\n Brave Browser: 103.1.41.100\r\n Chrome: 107.0.5304.110\r\n Safari: 15.3\r\n npmPackages:\r\n @tanstack/react-query: ^4.18.0 => 4.18.0 \r\n @trpc/client: ^10.4.1 => 10.4.1 \r\n @trpc/react-query: ^10.4.1 => 10.4.1 \r\n @trpc/server: ^10.4.1 => 10.4.1 \r\n next: ^12.0.8 => 12.0.8 \r\n react: ^17.0.2 => 17.0.2 \r\n typescript: ^4.5.4 => 4.5.4 \r\n```\r\n\r\n### Describe the bug\r\n\r\nI was on v10.0.0-rc.8 and upgraded to latest (as of now) v10.4.1 and suddenly got type errors on some frontend(react) calls.\r\nOn the server, the return type of the endpoint is a `User` interface generated by zod\r\n\r\nWhen retrieving the data using useQuery, there's an error when I pass down the data returned by the endpoint to a child component expected that same `User` interface\r\n\r\n```typescript\r\n const { data: user, error, isLoading } = trpc.user.getByEmail.useQuery(email)\r\n ...\r\n \u003CSomeComponent user={user} ... /> \r\n```\r\n result in \r\n \r\n ```\r\nType 'SerializeObject\u003CUndefinedToOptional\u003C{ source?: \"organic\" | \"organic-invite\" | \"organic-invite-pending\" | \"admin-invite\"; title?: userTitles; _uui\r\nd?: string; created_by?: string; invited_by?: unknown; isVerified?: boolean; ... 12 more ...; ssoSignup: boolean; }>>' is not assignable to type '{ source?: \"organic\" | \"organic-invite\" | \"organic-invite-pending\" | \"ad\r\nmin-invite\"; title?: userTitles; _uuid?: string; created_by?: string; invited_by?: unknown; isVerified?: boolean; ... 12 more ...; ssoSignup: boolean; }'.\r\n Types of property 'nameInfo' are incompatible.\r\n Type 'SerializeObject\u003CUndefinedToOptional\u003C{ firstName: string; lastName: string; }>>' is not assignable to type '{ firstName: string; lastName: string; }'.\r\n Property 'firstName' is optional in type 'SerializeObject\u003CUndefinedToOptional\u003C{ firstName: string; lastName: string; }>>' but required in type '{ firstName: string; lastName: string; }'.\r\n\r\n47 \u003CMyChildComponent user={user} />\r\n\r\n```\r\n \r\n\r\n\r\nI'm assuming this was introduced in [10.2.0](https://github.com/trpc/trpc/releases/tag/v10.2.0) maybe?\r\n\r\n\r\n### Link to reproduction\r\n\r\nhttps://stackblitz.com/edit/github-4mkvan?file=src/pages/index.tsx\r\n\r\n*** Edit ***\r\nI was able to reproduce on stackblitz but now after a small cleanup the error is gone and I can't reproduce :/ \r\nTrying to reproduce again\r\n\r\n### To reproduce\r\n\r\nThe user passed down to the child component triggers a typescript error in src/pages/index.tsx in the provided example\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### ๐จโ๐งโ๐ฆ Contributing\r\n\r\n- [ ] ๐โโ๏ธ Yes, I'd be down to file a PR fixing this bug!",[2953,2954],{"name":2918,"color":2919},{"name":2921,"color":2922},3307,"bug: SerializeObject\u003CUndefinedToOptional\u003CX>> is incompatible","2022-12-15T18:01:55Z","https://github.com/trpc/trpc/issues/3307",0.7224377,{"description":2961,"labels":2962,"number":2967,"owner":2874,"repository":2874,"state":2885,"title":2968,"updated_at":2969,"url":2970,"score":2971},"This is a super weird one. It may have been me who broke it, and I haven't been able to figure out how/why yet. My team's project hits this error trying to update to v9.6.0 (from v9.0.0-alpha.0, which was before #915 went in but after/somewhere in the middle of #718).\r\n\r\nWe're finding that *under certain conditions* `inferProcedureInput\u003C>` is returning `unknown` (in fact, it's the type inference of router definition - the procedure itself is `Procedure\u003CContext, Context, unknown, { ...result... }>`). Repro (note - this does _not_ repro in this repo, if you do `import * as trpc from '../src'` in a test, which is what I tried first. You can use this [playground link](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgUwB5mQYxgFQJ4YDyAZnAL5zFQQhwDkaG2AtDAcnQNwBQokscAFRwAhgGc4MKGEyVqtOgAEpMgPRjkUAG6a6vcNHgIAXhSo16xiABM93TBAB2Y+CLBgAShACuMTXABeSWlMADpqX00ACgBKUJBNAHNkKO44ehFrEGBHVToAGjTgmSL08J8-KFjSuHjfERhgJyi6PxcAWXrGpwLEGvScsF8ALjhjUIgAIwArLBgohH70yggIUfGXKBzE2MLl5bIYvf24KGQxCAAbHVHxPEdZBbhB33IYwIA+OAADABIEF4wULEVZkACE32O6UONXiwGs1kuyAA7iIzlE7g84E9HGh4IdPnBcah5jEjtwYjxuGwMHBOjAGk1nIFJOwIKQ3J4KppQgB9azIYh1BndZw8RhzfBEYgAHiKKjCOWImgACtRMMhrN4zgBJRxDGAy+mMpxiADadEy2VybRgxtFdAAuh9uB9YqEYBAAKIAR28IkuUuQJBlSBBazgm225DdlO4EuwQZD8pCoSVqvVmu1yD1BqNXSZ5stWRyqlt9qZTpdsdCjggQM9ACFkABVRwAazryMcsR4QA) to see it going wrong:\r\n\r\n```ts\r\nimport { expectTypeOf } from 'expect-type';\r\nimport * as trpc from '@trpc/server'\r\nimport {z} from 'zod'\r\n\r\nconst appRouter = trpc.router().merge(\r\n 'admin/',\r\n trpc\r\n .router()\r\n .mutation('testMutation', {\r\n input: z.object({\r\n foo: z.string(),\r\n }),\r\n resolve: async ({ input }) => `${input.foo}!`,\r\n })\r\n .middleware(async ({ next }) => next()),\r\n);\r\n\r\ntype Mutations = typeof appRouter._def.mutations;\r\n\r\nexpectTypeOf\u003C\r\n trpc.inferProcedureInput\u003CMutations['admin/testMutation']>\r\n>().toEqualTypeOf\u003C{ foo: string }>();\r\n\r\nexpectTypeOf\u003C\r\n trpc.inferProcedureInput\u003CMutations['admin/testMutation']>\r\n>().not.toBeUnknown();\r\n```\r\n\r\nThe two `expectTypeOf` tests fail. The second is just to show that the inferred type is `unknown` and that it isn't a typo/bad test setup.\r\n\r\nUpdate: The tests succeed if you remove the `.middleware(async ({ next }) => next())` line (in this case, the middleware is pointless - we are seeing it for a similar middleware that throws under certain circumstances)\r\n\r\nUpdate 2: It can also be repro'd by doing `import * as trpc from '../dist/trpc-server.cjs'` in this repo, which makes things much easier. Could there be some types that are being stripped at build time, maybe?",[2963,2964],{"name":2868,"color":2869},{"name":2965,"color":2966},"๐ง๐ป typescript wizardry","391441",949,"`inferProcedureInput` broken in published package","2022-10-04T18:08:21Z","https://github.com/trpc/trpc/issues/949",0.7231662,["Reactive",2973],{},["Set"],["ShallowReactive",2976],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$f-cB9SE7kp726-t8LmAVX5b3fZwCo-RqjWNJVAiJRmE4":-1},"/trpc/trpc-openapi/57"]