dotansimha / dotansimha/graphql-code-generator
enumsAsConst does not work with futureProofEnums
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
**Describe the bug**
Enabling `enumsAsConst` quietly ignores `futureProofEnums`.
**To Reproduce**
Steps to reproduce the behavior:
Enable `enumsAsConst` and `futureProofEnums`.
https://codesandbox.io/s/awesome-cohen-25m6r?file=/types.ts
1. My GraphQL schema:
```graphql
enum Foo {
BAR
BAZ
}
```
2. My GraphQL operations:
```graphql
N/A
```
3. My `codegen.yml` config file:
```yml
schema: schema.graphql
documents: document.graphql
generates:
types.ts:
plugins:
- typescript
config:
futureProofEnums: true
enumsAsConst: true
```
**Expected behavior**
`Foo` enum should describe `'%future added value'`.
```ts
export const Foo = {
Bar: 'BAR',
Baz: 'BAZ',
futureAddedValue: '%future added value',
} as const;
```
Instead I am getting:
```
export const Foo = {
Bar: 'BAR',
Baz: 'BAZ',
} as const;
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.