Skip to content

feat: expose enumsAsTypes and enumsAsConst options #627

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

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

m0nch1
Copy link
Contributor

@m0nch1 m0nch1 commented Apr 19, 2025

Description of Changes

This PR adds support for two additional graphql-codegen options in nuxt-graphql-client:

  • enumsAsTypes: Outputs GraphQL enums as union string literal types ('A' | 'B') instead of TypeScript enum.
  • enumsAsConst: Appends as const to enum objects to allow usage as readonly values in generated artifacts.

Example output with enumsAsTypes: true:

export type SortOrder = 'asc' | 'desc'; // ✅ instead of `enum SortOrder { ... }`

@m0nch1 m0nch1 changed the title feat: support enumsAsTypes and enumsAsConst options feat: expose enumsAsTypes and enumsAsConst options Apr 19, 2025
@m0nch1 m0nch1 marked this pull request as ready for review April 19, 2025 16:22
@m0nch1
Copy link
Contributor Author

m0nch1 commented Apr 22, 2025

@Diizzayy
I’d greatly appreciate it if you could take a moment to review this when you have some time!

@Diizzayy Diizzayy merged commit 451d128 into Diizzayy:main Apr 24, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants