Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DocumentTypeDecoration Not Imported inside graphql.ts #10176

Open
JamesParkDev opened this issue Oct 19, 2024 · 0 comments
Open

DocumentTypeDecoration Not Imported inside graphql.ts #10176

JamesParkDev opened this issue Oct 19, 2024 · 0 comments

Comments

@JamesParkDev
Copy link

Which packages are impacted by your issue?

@graphql-codegen/cli, @graphql-codegen/client-preset

Describe the bug

Package json

{
  "name": "graph-communication-network",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "@graphql-codegen/import-types-preset": "^3.0.0",
    "graphql": "^16.9.0"
  },
  "devDependencies": {
    "@graphql-codegen/cli": "5.0.3",
    "@graphql-codegen/client-preset": "4.4.0",
    "@graphql-codegen/introspection": "4.0.3",
    "@graphql-codegen/typescript": "4.1.0",
    "@graphql-codegen/typescript-document-nodes": "4.0.10"
  },
  "scripts": {
    "codegen": "graphql-codegen --config codegen.ts"
  }
}

when we run codegen everything gets generated but graphql has one type issue

Cannot find name 'DocumentTypeDecoration'.

image

Your Example Website or App

n/a

Steps to Reproduce the Bug or Issue

when we run codegen everything gets generated but graphql has one type issue

Cannot find name 'DocumentTypeDecoration'.

Expected behavior

It think generation should import/generate it.
Looking at local /examples we can see typescript example here https://github.com/dotansimha/graphql-code-generator/blob/master/examples/typescript-esm/src/gql/graphql.ts which imports it at the top, and I'm unsure why it is not included

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • NodeJS: v20.14.0
  • graphql version: 16.9.0
  • @graphql-codegen/* 5.0.3

Codegen Config File

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

const config: CodegenConfig = {
    overwrite: true,
    schema: "http://localhost:9000/graphql",
    documents: "src/**/*.tsx",
    ignoreNoDocuments: true,
    generates: {
        "src/gql/": {
            preset: "client",
            config: {
                documentMode: "string",
                onlyEnumTypes: false,
                onlyOperationTypes: false,
                useTypeImports: true,
            },
            plugins: [
            ]
        },
        "./graphql.schema.json": {
            plugins: ["introspection"]
        },
        "./schema.graphql": {
            plugins: ["schema-ast"],
            config: {
                includeDirectives: true
            }
        }
    }
};

export default config;

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@JamesParkDev and others