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
@kamilmysliwiec I ended up finding an existing NestJS GraphQL flag that will output the enums as a union string type and that's fine for my purposes. I don't know if that is documented anywhere and I'm googling it now and can't find anything on it.
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
TypeScript enums have known issues:
https://dev.to/ivanzm123/dont-use-enums-in-typescript-they-are-very-dangerous-57bh
This is an example of this with GraphQL types generated by NestJS:
Because if this, if I have a return value from an Prisma enum
Describe the solution you'd like
By default, Prisma generates TS enums as consts, instead of enums. I recommend doing that.
GraphQL Codegen has options to help address this:
https://the-guild.dev/graphql/codegen/plugins/typescript/typescript#constenums
https://the-guild.dev/graphql/codegen/plugins/typescript/typescript#enumsastypes
I propose exposing this and other GraphQL codegen options in the API
Teachability, documentation, adoption, migration strategy
enum consts are backwards compatible, so this shouldn't hurt anything
What is the motivation / use case for changing the behavior?
enum consts just work better all around!
The text was updated successfully, but these errors were encountered: