Skip to content
Discussion options

You must be logged in to vote

Hi @remko79,

Splitting types and resolvers types can be achieved by using the import-types-preset plugin as showcased in this working example: https://github.com/charlypoly/codegen-repros/blob/master/resolvers-import-types/codegen.ts

codegen.ts (but also works as .yml, .json or .js config)

import { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
  schema: "schema.graphql",
  documents: ["src/**/*.ts"],
  generates: {
    "types.ts": {
      plugins: ["typescript"],
    },
    "resolvers-types.ts": {
      preset: "import-types-preset",
      presetConfig: {
        typesPath: "./types.js", // .js for ESM support
      },
      plugins: ["typescript-resolvers"],

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by charlypoly
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants