Skip to content

Support graphql-config type #26

Open
@deathemperor

Description

@deathemperor

I'm using this plugin with https://the-guild.dev/graphql/config/docs. although the type causes TS error, it works:

error

Argument of type 'IGraphQLConfig' is not assignable to parameter of type 'Options | undefined'.
  Type 'IGraphQLProject' has no properties in common with type 'Options'.ts(2345)

sample of graphql-config

import type { IGraphQLConfig } from "graphql-config";

const codegenConfig: IGraphQLConfig = {
  schema,
  documents: ["src/**/!(*.generated).{tsx,ts,graphql,gql}", "!src/sdk/**/*", "!node_modules"],
  extensions: {
    languageService: {
      cacheSchemaFileForLookup: true,
    },
    codegen: {
      overwrite: true,
      watch: CODEGEN_WATCH === "true",
      ignoreFieldConflicts: true,
      generates: {
        "src/sdk/gql/types.ts": {
          config: {
            ...config,
          },
          plugins: [
            "typescript",
          ],
        },
        "src/": {
          preset: "near-operation-file",
          presetConfig: {
            extension: ".generated.ts",
            baseTypesPath: "sdk/gql/types.ts",
          },
          plugins: [
            "typescript-operations",
            "typed-document-node",
            {
              add: {
                content: `/* eslint-disable */`,
              },
            },
          ],
        },
      },
    },
  },
};

export default codegenConfig;

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions