You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using graphql codegen hooks, which results are of the type: ApolloReactCommon.QueryResult, meaning it's an object that has data, loading and error fields.
Most generally, I'll use the data in other components, where I need to define its type. I currently need to write something like this to get data type:
typeMyPost=MyPostQueryHookResult['data']
I would have expected to get this MyPost type created for me. Is there a way to have it generated automatically?
In order to access sub-types (or intermediate types), use a bridge type like you did, or use more fragments in your code (because fragment spreads is being generated on it's own) or use typescript-compatibility. I wrote a long explanation regarding those types, feel free to look for it in the repo :)
Hello
I'm using graphql codegen hooks, which results are of the type: ApolloReactCommon.QueryResult, meaning it's an object that has data, loading and error fields.
Most generally, I'll use the data in other components, where I need to define its type. I currently need to write something like this to get data type:
I would have expected to get this MyPost type created for me. Is there a way to have it generated automatically?
My config:
Note, this is a cross post from SO where I was unlucky, I'll update the question as soon as I get an answer.
The text was updated successfully, but these errors were encountered: