-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only export enum type #3475
Comments
@TomasBarry Does that covers you use-case? I don't understand why generating only enums is related? |
Closing. @TomasBarry let me know if it's still relevant. |
@dotansimha the feature could make sense for another use case. Let's say that you want to use a |
@darkbasic I see. I'm not sure if it's related, but does const enum assertions works in |
@dotansimha that's the problem: const enums don't work in |
Done in: #3760 |
Thank you @dotansimha! |
Fixed in v1.13.4 :) You can now use: config:
preResolveTypes: true
onlyOperationTypes: true And you'll get minimal types generated. |
@dotansimha thanks for putting in the work to add those additional flags! One issue is I would like to only generate enums and not create types in the .ts file. Is that possible? |
It's not available at the moment, you can create a PR if you need that ;) |
We need this as well for the exact reason stated here:
|
Solved this in #7718 @dotansimha |
Is your feature request related to a problem? Please describe.
The flexibility of GraphQL queries severely limits the use of exported types in the generated file of Flow types.
Consider the following schema:
It would be fragile to type the return value of a GraphQL query with the type of
MyType
as Flow would not be able to assist us if we changed the query from:To:
Describe the solution you'd like
We would like a mechanism to just generate types for enums and skip over GraphQL types.
Describe alternatives you've considered
The alternative is manually defining and maintaining enums in Flow or limiting ourselves to just importing the enums. However, if the types can be imported it is not reasonable for us to be able to police every commit from using them.
The text was updated successfully, but these errors were encountered: