graphql-modules-preset doesn't obey enumsAsTypes and doesn't generate per-module Resolvers types for enum internal values
See original GitHub issueDescribe the bug
When using the graphql-modules preset it always generates enum as TypeScript type instead of enum, even if you specify enumsAsTypes: false
(which is the default anyway).
Also it doesn’t generate per-module Resolvers types for enum internal values (it does in the complete schema types).
To Reproduce This is the repro: https://github.com/darkbasic/gqlmodules-codegen-enumastypes-repro This is the codesandbox url: https://codesandbox.io/s/github/darkbasic/gqlmodules-codegen-enumastypes-repro
About the enums Resolvers types as you can see they get generated in the complete schema types: https://github.com/darkbasic/gqlmodules-codegen-enumastypes-repro/blob/master/src/types/graphql.ts#L133 While they don’t in the per-module schema types: https://github.com/darkbasic/gqlmodules-codegen-enumastypes-repro/blob/master/src/modules/A/types/module-types.ts#L19 https://github.com/darkbasic/gqlmodules-codegen-enumastypes-repro/blob/master/src/modules/B/types/module-types.ts Module B doesn’t even have a Resolvers type because I didn’t add a dummy Query to it.
About the enumsAsTypes issue just look here: https://github.com/darkbasic/gqlmodules-codegen-enumastypes-repro/blob/master/src/types/graphql.ts#L21
As you can see it clearly doesn’t obey enumsAsTypes: false
. If you comment out the graphql-modules preset it will work as expected.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
@dotansimha,
Are there any plans to fix this (specifically, per-module resolver types with enums)? I think this issue is actually rather problematic since most any reasonably useful project will use enums and most any large project would likely find
graphql-modules-preset
useful were it not for this issue. I’m finding myself removing the preset just because I want to define my enums in my module resolvers, but then I lose module-specific types.Would love to know about any updates on this front. Thanks!
@ardatan 😅 Well hey I just might, got a few things on my plate right now but let me take a deeper look when I get a breath.