graphql-code-generator-community
graphql-code-generator-community copied to clipboard
Add `asNonEmptyTuple` config option for `typescript-enum-array` plugin
Description
Description already discussed in my issue. The goal is to have a traceable, zod-compatible array declaration by allowing us to generate arrays with non-empty tuple type declarations. as const lets us use the arrays in zod enums, but will show the enum declaration as a raw, unnamed string union. This makes it tougher in large codebases to trace the origins of the parsed zod schemas.
Related #1243
Type of change
Please delete options that are not relevant.
- [X] New feature (non-breaking change which adds functionality)
Screenshots/Sandbox (if appropriate/relevant):
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [X]
packages/plugins/typescript/enum-array/tests/enum-array.spec.tswithasNonEmptyTuple
Checklist:
- [X] I have followed the CONTRIBUTING doc and the style guidelines of this project
- [X] I have performed a self-review of my own code
- [X] I have commented my code, particularly in hard-to-understand areas
- [X] I have made corresponding changes to the documentation
- [X] My changes generate no new warnings
- [X] I have added tests that prove my fix is effective or that my feature works
- [X] New and existing unit tests pass locally with my changes
- [X] Any dependent changes have been merged and published in downstream modules