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 mappingBasically, 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-resolversYou 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
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! I'm using the code generator with the
graphql-modulespreset, and trying to set up a resolver that will return a different value for an enum. If I useenumValuesand map to the enum that I want, the resolver is generated in thebaseTypesPathfile but not in thefilenamefile for each module. Given that, I suspect I'd have to import that type in from thebaseTypesPathfile. Is that the way to do it? Is there another way to specifyenumValueswhile using that preset?Beta Was this translation helpful? Give feedback.
All reactions