All values in DecoratedProcedureRecord are of type any
I've stumbled across an issue and I'm not sure how to start diagnosing it...
Basically in my IDE the return type of my
createTRPCProxyClient<AppRouter>(...)
call is a DecoratedProcedureRecord
where every value is of type any
.
I'm seeing a lot of issues with TS seemingly struggling to work with this repo, I suspect that the types have become too complex with tRPC and the ORM I'm using. Is it possible that TS has just "given up" so returns any instead of the expected type? Or is it likely something else?7 Replies
I've tried stripping down the router to a single merge with one procedure though and it's still of type
any
π€·ββοΈ
Ah, I think it's related to using paths
in a ts-config in a monorepo, seems like the consuming package potentially can't resolve the importsCan you share your project structure and the tsconfig for the client?
I can if it would be helpful, anything specifically? I'm certain this isn't a tRPC issue now though, I removed path aliases from the internal package/tsconfig and the types reappeared.
Yeah itβs more project setup, but we treat that as something we can generally help figure out!
Not sure if this is clear or not! Appreciate the help but no pressure of course π
root tsconfig:
server tsconfig:
client tsconfig:
Do you have separate package.json files or just one in the root?
or you're using npm workspaces?
Often adding the server file which exports the AppRouter to the client's tsconfig "include" fixes a lot of issues (via relative path)
If you then run into anything complaining about non-portable types that would generally happen when you have separate node_modules folders via separate package.json files. Using workspaces with hoisting, or installing in the root can help there
Hey thanks, yes separate package.json files, using turborepo and npm workspaces (I think), all dependencies are installed in the root node_modules dir. I'll see if adding the server file to "include" helps, appreciate the advice π