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

Generator generates alias imports not compatible with TypeScript Type-Only Imports and verbatimModuleSyntax #3963

Closed
lubos-bistak opened this issue Aug 29, 2023 · 2 comments

Comments

@lubos-bistak
Copy link

By running npx graphql-code-generator graphql.ts files are generated with imports

import {TypedDocumentNode as DocumentNode} from '@graphql-typed-document-node/core'

that are not compatible with TypeScript configuration

tsconfig.ts

"compilerOptions": {
    "verbatimModuleSyntax": true
}

It should be

import {type TypedDocumentNode as DocumentNode} from '@graphql-typed-document-node/core'

Documentation:

Is there any option to control how such imports are generated?

@IvanGoncharov
Copy link
Member

@lubos-bistak graphql-code-generator is not part of this organization and is not related to this repo. Can you please open issue in graphql-code-generator repo

@lubos-bistak
Copy link
Author

This issue can be solved with

const config: CodegenConfig = {
  ...
  generates: {
    "src/gql/": {
      ...
      config: {
        useTypeImports: true
      },
    }
  }
};

also described in dotansimha/graphql-code-generator#9595

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