-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
32 lines (30 loc) · 827 Bytes
/
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
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: './src/api/type-defs/**/*',
generates: {
'./src/@types/graphql.ts': {
plugins: [
// Generate TypeScript types from the GraphQL schema
'typescript',
// Enable scalars customization
'typescript-operations',
// Import mongoose into the generated file
{
add: {
content: 'import mongoose from "mongoose";\n',
},
},
],
config: {
// https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-operations#scalars
scalars: {
ID: {
input: 'string',
output: 'mongoose.Types.ObjectId | string',
},
},
},
},
},
};
export default config;