Plugins
Presets
import-types

Plugin Details

Package name@graphql-codegen/import-types-preset
Weekly Downloadsdownloads
Versionlicense
Licenselicense
UpdatedAug 8th, 2022

Installation

yarn add -D @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
Last updated on August 10, 2022