Replies: 1 comment
-
I suppose you can try to write a custom plugin where during the visit you can export strings as a type yourself? |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I have some GraphQL enums where the values are used as menu items in a drop down menu and the descriptions are used as tooltip text to provide information about each item.
Currently I'm running a
__type
query when the page loads, but I'd like to instead use the generated TypeScript types so that this query isn't needed and so that introspection queries can be disabled generally. The GraphQL enums converted to TS look like:I'm looking for advice on how to pull out the description fields. Is there a way to do this with
graphql-code-generator
that perhaps maps GraphQL enums to a different type than an a TS enum or puts the descriptions in a separate object? Or perhaps I could parse the description comment strings out of the generated code file (although that feels a bit hacky)?I'm using the following versions:
With the following config:
Beta Was this translation helpful? Give feedback.
All reactions