Skip to content

[BUG] gcg-typescript-resolver-files defineConfig function shows a type error #428

Closed

Description

@Jaime02

I am getting a type error in the codegen.ts file due to the return value of defineConfig function:

Type 'Pick<ConfiguredOutput, "preset" | "presetConfig" | "schema" | "hooks" | "watchPattern">' is not assignable to type 'ConfiguredOutput | ConfiguredPlugin[]'.
  Type 'Pick<ConfiguredOutput, "preset" | "presetConfig" | "schema" | "hooks" | "watchPattern">' is not assignable to type 'ConfiguredOutput'.
    Types of property 'preset' are incompatible.
      Type 'import("<PATH>/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.PresetNames | import("<PATH>/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.OutputPreset<any> | undefined' is not assignable to type 'import("<PATH>/node_modules/@graphql-codegen/cli/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.PresetNames | import("<PATH>/node_modules/@graphql-codegen/cli/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.OutputPreset<any> | undefined'.
        Type 'OutputPreset<any>' is not assignable to type 'PresetNames | OutputPreset<any> | undefined'.
          Type 'import("<PATH>/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.OutputPreset<any>' is not assignable to type 'import("<PATH>/node_modules/@graphql-codegen/cli/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.OutputPreset<any>'.
            Types of property 'buildGeneratesSection' are incompatible.
              Type '(options: import("<PATH>/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.PresetFnArgs<any, { [key: string]: any; }>) => import("<PATH>/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.Promisable<import("<PATH>/node_modules/@graphql-codegen/plugin-...' is not assignable to type '(options: import("<PATH>/node_modules/@graphql-codegen/cli/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.PresetFnArgs<any, { [key: string]: any; }>) => import("<PATH>/node_modules/@graphql-codegen/cli/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.Promis...'.
                Types of parameters 'options' and 'options' are incompatible.
                  Type 'import("<PATH>/node_modules/@graphql-codegen/cli/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.PresetFnArgs<any, { [key: string]: any; }>' is not assignable to type 'import("<PATH>/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.PresetFnArgs<any, { [key: string]: any; }>'.
                    Types of property 'documents' are incompatible.
                      Type 'import("<PATH>/node_modules/@graphql-codegen/cli/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.DocumentFile[]' is not assignable to type 'import("<PATH>/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.DocumentFile[]'.
                        Type 'import("<PATH>/node_modules/@graphql-codegen/cli/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.DocumentFile' is not assignable to type 'import("<PATH>/node_modules/@graphql-codegen/plugin-helpers/typings/types").Types.DocumentFile'.
                          Types of property 'hash' are incompatible.
                            Type 'string | null | undefined' is not assignable to type 'string | undefined'.
                              Type 'null' is not assignable to type 'string | undefined'.

To Reproduce
I think this set up should be enough:

import { defineConfig } from "@eddeee888/gcg-typescript-resolver-files";
import type { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
  generates: {
    "./src/graphql/generated/server/": defineConfig({
      ...
    }),
  },
};

export default config;

OS: Windows 11
Packages:

  • @eddeee888/gcg-typescript-resolver-files: 0.15.0
  • @graphql-codegen/cli: 6.3.0

Activity

  1. eddeee888 commented on Apr 16, 2026

    @eddeee888
    Owner

    This has been fixed in @eddeee888/gcg-typescript-resolver-files@0.15.1

    Thanks for reporting @Jaime02 !
    Please let me know if you still have issues and I'll re-open this

  2. Jaime02 commented on Apr 17, 2026

    @Jaime02
    Author

    Fixed, thank you so much, I really appreciate it ❤️❤️

  3. LongLiveCHIEF commented on Jul 30, 2026

    @LongLiveCHIEF

    This one seems to be happening again with:

    devDependencies:
    + @eddeee888/gcg-typescript-resolver-files 0.17.0
    + @graphql-codegen/cli 7.2.0
    + graphql 17.0.2
    + graphql-scalars 1.25.0
    

    Using the exact same basic config demo from the README of the plugin.

    // codegen.ts
    import type { CodegenConfig } from '@graphql-codegen/cli';
    import { defineConfig } from '@eddeee888/gcg-typescript-resolver-files';
    
    const config: CodegenConfig = {
      schema: '**/schema.graphql',
      generates: {
    	  'src/schema': defineConfig()
      },
    };
    
    export default config;
  4. eddeee888 commented on Aug 9, 2026

    @eddeee888
    Owner

    Hello, I've released v0.18 with a few bumps to latest dep versions. This works in a repo I had

    Could you please try?

  5. haydn commented on Aug 11, 2026

    @haydn

    @eddeee888 I just updated and the problem was solved. 👍

  6. mbaker40 commented on Nov 16, 2026

    @mbaker40

    @eddeee888, unfortunately seeing this again with the codegen v8 release:

    @eddeee888/gcg-typescript-resolver-files 0.20.0
    @graphql-codegen/cli 8.0.0
    

    Same error as the OP -> defineConfig()'s return type isn't assignable to CodegenConfig['generates'][string], failing on preset → buildGeneratesSection. 0.20.0 still depends on @graphql-codegen/plugin-helpers ^7.4.2 (plus typescript ^6.1.1 / typescript-resolvers ^6.1.1), so its OutputPreset comes from a different plugin-helpers major than cli 8's CodegenConfig. Runtime generation still works, but still getting a type error.

  7. eddeee888 commented on Nov 19, 2026

    @eddeee888
    Owner

    Ah thanks for the callout @mbaker40
    I'll look into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions