The Guild LogoThe Guild Monogram
Docs

GraphQL Code Generator

Generate anything from GraphQL schema / operations!

Contact Us

import-types-preset

yarn add @graphql-codegen/import-types-preset

This preset generates a file per each operation file, and allow to import types from another file.

Config API Reference#

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.

Usage Examples#

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.

Usage Examples#

generates: src/: preset: import-types presetConfig: typesPath: types.ts importTypesNamespace: SchemaTypes plugins: - typescript-operations

Package Details