Import types preset not importing types #4830
-
Hi all, and first of all thank a lot for your job! I think I am facing an issue with the schema: ./src/**/*.graphql
hooks:
afterAllFileWrite:
# Format files
- prettier --write
generates:
# Schema types
./src/graphql/schema-types.ts:
config:
scalars:
Date: Date
plugins:
- typescript
# Resolvers types
./src/graphql/resolvers-types.ts:
preset: import-types
presetConfig:
typesPath: ./schema-types
plugins:
- typescript-resolvers
# Models types
./src/database/models-types.ts:
preset: import-types
presetConfig:
typesPath: ./../graphql/schema-types
plugins:
- typescript-mongodb:
dbTypeSuffix: Database
dbInterfaceSuffix: Database
enumsAsString: false In Am I doing something wrong? Context : {
"@graphql-codegen/cli": "1.17.10",
"@graphql-codegen/import-types-preset": "1.17.9",
"@graphql-codegen/typescript": "1.17.10",
"@graphql-codegen/typescript-resolvers": "1.17.10",
"@graphql-codegen/typescript-mongodb": "1.17.8"
} Is it a version problem/incompatibility? Thank you for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This kind of integration is not supported yet. Tracking this here: https://github.com/dotansimha/graphql-code-generator/issues/4901 |
Beta Was this translation helpful? Give feedback.
-
Just don't use the preset all, it doesn't have much value added anyway. Import types with const config: CodegenConfig = {
generates: {
'types.generated.ts': {
plugins: ['typescript'],
},
'resolvers.generated.ts': {
plugins: ['add', 'typescript-resolvers'],
config: {
content: 'import * as types from "./types.generated"',
namespacedImportName: 'types',
},
},
},
} |
Beta Was this translation helpful? Give feedback.
This kind of integration is not supported yet. Tracking this here: https://github.com/dotansimha/graphql-code-generator/issues/4901