Replies: 1 comment 1 reply
-
Hi @mm-wang ! We have a standard for creating Here are a few examples: config:
mappers:
MyEnum: './file#Test' # type Test from ./file
MyType1: string # map to a custom primitive
MyType2: 'MyNamespace.MyType' # map to namespace
MyType3: '{}' # map to an inline TS type
MyType4: 'A | B' # map to multiple types
MyType5: 'libphonenumber-js#PhoneNumber as ParsedPhoneNumber' # super custom mapping Basically, anything you specify before ./server/src/modules/:
preset: graphql-modules
presetConfig:
baseTypesPath: ../generated-types/graphql.ts
filename: generated-types/graphql.ts
encapsulateModuleTypes: namespace
config:
mappers:
MyCustom: 'JustIdentifier'
plugins:
- add:
content: |
import { JustIdentifier } from "custom";
- typescript
- typescript-resolvers You can read more here: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I'm using the code generator with the
graphql-modules
preset, and trying to set up a resolver that will return a different value for an enum. If I useenumValues
and map to the enum that I want, the resolver is generated in thebaseTypesPath
file but not in thefilename
file for each module. Given that, I suspect I'd have to import that type in from thebaseTypesPath
file. Is that the way to do it? Is there another way to specifyenumValues
while using that preset?Beta Was this translation helpful? Give feedback.
All reactions