somehow when move typed function out of the router files, frontend infer type to be any ?
this is inferred corrected since they are in the same file.
6 Replies
which is a very weird issue.
not sure, probably unrelated to trpc
@Ahmed Eid any solution found?
What exactly do you refer as typing is broken? I think I got the same issue and my types result to
any
I made a repo that reproduces my issue, not sure its the same https://stackoverflow.com/questions/74185198/typescript-losing-zod-and-trpc-types-across-monorepo-projects-types-result-inStack Overflow
Typescript, losing Zod and tRPC types across monorepo projects, typ...
I am in a bit of a weird situation. For the past 2 weeks I've been trying to debug as to why I am losing types between my projects inside a monorepo. My backend exposes the types that my client use...
@ItsWendell I think I resolved it, if you're still facing this issue please let me know I think I can help you out.
I have a simar issue with a turbo repository, where 'second hand' types are infered as any, e.g. I have a package with the TRPC API, which might return types from an external package.
I use the TRPC package types in our app, but all types that are infered from external packages are any, all types that I give directly are fine.
One solution I have is to use
references
in tsconfig like this:
BUT I believe this might have performance impact + it's annoying to have to think about adding this to every package that consumes the API service types