graphql-code-generator: Property 'enter' does not exist on type '{ readonly enter?: ASTVisitFn ...

Describe the bug

Getting the following build errors with TS:

node_modules/@graphql-codegen/plugin-helpers/oldVisit.d.ts:5:75 - error TS2339: Property 'enter' does not exist on type '{ readonly enter?: ASTVisitFn<NameNode> | undefined; readonly leave: ASTReducerFn<NameNode, unknown>; } | { readonly enter?: ASTVisitFn<DocumentNode> | undefined; readonly leave: ASTReducerFn<...>; } | ... 41 more ... | undefined'.

5     enter?: Partial<Record<keyof NewVisitor, NewVisitor[keyof NewVisitor]['enter']>>;
                                                                            ~~~~~~~

node_modules/@graphql-codegen/plugin-helpers/oldVisit.d.ts:6:75 - error TS2339: Property 'leave' does not exist on type '{ readonly enter?: ASTVisitFn<NameNode> | undefined; readonly leave: ASTReducerFn<NameNode, unknown>; } | { readonly enter?: ASTVisitFn<DocumentNode> | undefined; readonly leave: ASTReducerFn<...>; } | ... 41 more ... | undefined'.

6     leave?: Partial<Record<keyof NewVisitor, NewVisitor[keyof NewVisitor]['leave']>>;

To Reproduce

Use together:

    "@graphql-codegen/plugin-helpers": "^2.4.1",
    "graphql": "^16.3.0"

Then just importing it will trigger the bug:

import type { Types } from '@graphql-codegen/plugin-helpers';
  1. My GraphQL schema:
N/A
  1. My GraphQL operations:
N/A
  1. My codegen.yml config file:
N/A

Expected behavior

Not produce build errors.

Environment:

  • OS: macOS
  • @graphql-codegen/plugin-helpers: 2.4.1
  • NodeJS: v14.17.6

Additional context

N/A

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 2
  • Comments: 16 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Weird, nuked node_modules, and re-installed. Fixed the problem. 🤷🏼

If not, could you send here the portion of your lockfile (yarn or npm) that shows the graphql version resolution?

Will do, if I can repro the issue again.

Do you have any version of graphql installed globally?

Good question.

Seems like no?

❯ npm ls -g graphql
/Users/xyz/.fnm/node-versions/v14.17.6/installation/lib
└── (empty)