We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
enumsAsConst
enumsAsConst is ignored:
import type { CodegenConfig } from '@graphql-codegen/cli' const config: CodegenConfig = { schema: './src/modules/**/typedefs/*.graphql', generates: { './src/modules/': { preset: 'graphql-modules', presetConfig: { baseTypesPath: '../generated-types/graphql.ts', filename: 'generated-types/module-types.ts', }, plugins: [ { typescript: { enumsAsConst: true, // ❌ Does not work }, }, { 'typescript-resolvers': {} }, ], }, }, } export default config
because graphql-modules-preset overwrites typescript plugin config as enumsAsTypes: true, so enumsAsConst: true is ignored.
enumsAsTypes: true
enumsAsConst: true
config: { ...options.config, enumsAsTypes: true, // 🙁 },
https://github.com/dotansimha/graphql-code-generator/blob/master/packages/presets/graphql-modules/src/index.ts#L69
Accept a config something like this in ModulesConfig:
ModulesConfig
export type ModulesConfig = { ... disableOverwritesEnumsAsConfig: boolean; ... };
https://github.com/dotansimha/graphql-code-generator/blob/master/packages/presets/graphql-modules/src/config.ts
import type { CodegenConfig } from '@graphql-codegen/cli' const config: CodegenConfig = { schema: './src/modules/**/typedefs/*.graphql', generates: { './src/modules/': { preset: 'graphql-modules', presetConfig: { baseTypesPath: '../generated-types/graphql.ts', filename: 'generated-types/module-types.ts', disableOverwritesEnumsAsConfig: true, // ✅ Add }, plugins: [ { typescript: { enumsAsConst: true, // ✅ Works! }, }, { 'typescript-resolvers': {} }, ], }, }, } export default config
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is your feature request related to a problem? Please describe.
enumsAsConst
is ignored:because graphql-modules-preset overwrites typescript plugin config as
enumsAsTypes: true
, soenumsAsConst: true
is ignored.https://github.com/dotansimha/graphql-code-generator/blob/master/packages/presets/graphql-modules/src/index.ts#L69
Describe the solution you'd like
Accept a config something like this in
ModulesConfig
:https://github.com/dotansimha/graphql-code-generator/blob/master/packages/presets/graphql-modules/src/config.ts
Describe alternatives you've considered
No response
Is your feature request related to a problem? Please describe.
No response
The text was updated successfully, but these errors were encountered: