Turborepo internal package exported procedure context type `any`
I am working on moving our trpc API to a separate internal package away from our next.js app, but running into an issue where the
ctx
type is any
in the Next.js app. Even though the type is shown when I hover the procedure itself. Any idea what this could be?

15 Replies
I got the same message when I was implementing tRPC into my test turborepo and I never got it to work.
Man, that is unfortunate to hear LOL
Hope someone else may have a solution
I found a solution to your problem
GitHub
GitHub - edgar-guzman/small-trpc-example-turbo
Contribute to edgar-guzman/small-trpc-example-turbo development by creating an account on GitHub.
Sick! Could you share what part of this repo solves it / I have to look at? Also feel free to @ me since I may not see it otherwise
Yeah I can compress, Do you see the create-context file when viewing the repo? (packages/trpc/src/create-context.ts) and This is one of the way I got this to work and when you hover over the word 'ctx' it should say what typed it is.
This doesn't solve it not working in another package / app though, does it?
I use the v11 rc version of tRPC: which is 11.0.0-rc.730
I use 11.0.1
Interesting
I will try and use the v11 instead of rc
Let's me know if this work, I bump up version to 11.0.1
GitHub
GitHub - edgar-guzman/small-trpc-example-turbo at refactor/bump-up-...
Contribute to edgar-guzman/small-trpc-example-turbo development by creating an account on GitHub.
this is so heartbreaking because i am currently facing the same issue and there's nothing i haven't tried. doesn't work. trpc itself is typed as any. can't get it to work no matter what i do
I got it working by changing the way my internal packages work. What does your setup look like?
I believe that this is a similar problem to this: https://github.com/trpc/trpc/issues/6753
That bug report contains a patch you can use to temporarily fix things.
GitHub
bug: generated
.d.ts
files leaking un-exported types · Issue #67...Provide environment information System: OS: macOS 14.5 CPU: (12) arm64 Apple M2 Max Memory: 73.41 MB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/nod...
using
patch-package
or pnpm patch