Extract Object types #233
-
I discovered that PS: Thank you for this awesome library! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
There is a dedicated helper to extract input, scalar, and enum types, as per: https://gql-tada.0no.co/reference/gql-tada-api#graphql-scalar As per other discussions and issues, you by definition can't extract object types. |
Beta Was this translation helpful? Give feedback.
-
Hi, I tried to use ResultOf to get the type from a query, but all fields are nullable. How can I remove the nullability? |
Beta Was this translation helpful? Give feedback.
-
@kitten what if I need to pass a query's field which is an object as a prop to some component - how do I define a type of the object for it with gql.tada, not only just the ResultOf the whole TadaDocumentNode? I believe it's a very common situation when you pass objects as props. I assumed it might be something like |
Beta Was this translation helpful? Give feedback.
There is a dedicated helper to extract input, scalar, and enum types, as per: https://gql-tada.0no.co/reference/gql-tada-api#graphql-scalar
As per other discussions and issues, you by definition can't extract object types.
Object types don't have a fixed type, since their type is dependent on a selection. Instead, you'd always create a specific fragment of what data a piece of code depends on and then compose these fragments upwards — details here: https://gql-tada.0no.co/guides/fragment-colocation