yarn add @graphql-codegen/import-types-preset
pnpm add @graphql-codegen/import-types-preset
npm install @graphql-codegen/import-types-preset
This preset generates a file per each operation file, and allow to import types from another file.
typesPath
type: string
Required, should point to the base schema types file. The key of the output is used a the base path for this file.
generates:
path/to/file.ts:
preset: import-types
presetConfig:
typesPath: types.ts
plugins:
- typescript-operations
importTypesNamespace
type: string
default: Types
Optional, override the name of the import namespace used to import from the baseTypesPath
file.
generates:
src/:
preset: import-types
presetConfig:
typesPath: types.ts
importTypesNamespace: SchemaTypes
plugins:
- typescript-operations
MIT
2.1.18
May 9th, 2022
75627