-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodegen.ts
35 lines (34 loc) · 1.06 KB
/
codegen.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import type {CodegenConfig} from '@graphql-codegen/cli';
export default <CodegenConfig>{
schema: './schemas/schema.graphql',
documents: undefined,
overwrite: true,
emitLegacyCommonJSImports: false,
generates: {
'./src/generated/graphql.ts': {
plugins: [
'typescript',
'typescript-resolvers',
'typescript-operations',
'typed-document-node',
],
config: {
useIndexSignature: true,
// contextType: '../context.js#Context',
allowParentTypeOverride: true,
// https://github.com/dotansimha/graphql-code-generator/issues/2932#issuecomment-582862732
mapperTypeSuffix: 'Model',
scalars: {
// Note: without below configuration, ID will be mapped to string or number.
ID: 'string',
},
enumValues: {},
mappers: {
// https://github.com/dotansimha/graphql-code-generator/issues/1793#issuecomment-488302686
},
inputMaybeValue: 'T | undefined | null',
defaultMapper: 'Partial<{T}>',
},
},
},
};