[graphql-operations] How can I use query types ? #7446
Unanswered
kimurakenshi
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hi all, thank you for building this amazing tool. I'm just starting to integrate this tool into my project and have a quick question. I want to refer to the type generated in the query for a nested node so I can type graphql query responses. How can I do that? Since the type is generated inline I cannot refer to a nested type:
Example
GraphQL Codegen Config
Query
Generated Type
Application
I tried using
Pick
but it doesn't support nested props. Any ideas of how I could achieve this?Thank you.
Update: I ended up creating fragments to extract the section of the response type I wanted to import in my application code and that seems to be a good approach for my use case.
Beta Was this translation helpful? Give feedback.
All reactions