save return type to type var
Hello, I want to save the type that return from useQuery to type variable. For example, I have this complex return type from the query and would like to do something like type userInfoType = object.
Please point me to some direction. Thank youuuuu ❤️
5 Replies
Inferring Types | tRPC
It is often useful to wrap functionality of your @trpc/client or @trpc/react api within other functions. For this purpose, it's necessary to be able to infer input types, output types, and api paths generated by your @trpc/server router.
Thank youu
I have a follow-up question. So I follow your approach, but cannot denested the type and got the following type error. Any recommendation?
Maybe you need to wrap the preceding type with NonNullable
That save it. Thanks alex