TRPCContextState not found in v10
In our v9 app, we used TRPCContextState from internals to type out TRPC utils, importing it like
import { TRPCContextState } from '@trpc/react-query/dist/declarations/src/internals/context';
and using it in types like trpcUtils: TRPCContextState<AppRouter, any>;
Is there a quick alternative to this? Can't find it in the the latest trpc10 code packages.6 Replies
I can't remember what that was used for, could you elaborate on what you need it for?
Typing out trpc.utils maybe, it is hard to tell. The interfaces I see it in are very type-happy
Yeah, I'm seeing it used as a type for trpc.useContext()
perhaps a better question: is there a type we can use for trpc.useContext() in trpc 10?
What's the functionality you need to abstract?
If you show me the fns you have created in v9 it'd be easier to give guidance
What sort of helpers are you making?
We're putting trpc.utils in ReactContext state, so we've been using TRPCContextState for trpc.utils in ReactContext interface
You could just use
typeof trpc.utils
then for your type, right?Thanks Katt, that does it... seems so obvious now 😂