ardeois / graphql-codegen-typescript-mock-data

[GraphQL Codegen Plugin](https://github.com/dotansimha/graphql-code-generator) for building mock data based on the schema.
MIT License
134 stars 46 forks source link

TypeError: visitFn.call is not a function #69

Closed TokiyaHorikawa closed 2 years ago

TokiyaHorikawa commented 2 years ago

Thank you for making this plugin! .🌸 Share about the errors I encountered.

This error when I did yarn codegen.

✖ ./graphql/mock.ts
    TypeError: visitFn.call is not a function

I dropped "grapql" from v16 to v15.8.0 and it ran fine.

This is my schema:

overwrite: true
schema: ${API_URL}/graphql
documents: 'graphql/**/*.graphql'
generates:
  ./graphql.schema.json:
    plugins:
      - 'introspection'
  ./graphql/graphql.ts:
    plugins:
      - 'typescript'
      - 'typescript-operations'
      - typescript-react-query
    config:
      fetcher: graphql-request
  ./graphql/mock.ts:
    plugins:
      - typescript-mock-data:
        typeFile: './graphql/graphql.ts'
        addTypename: true
        prefix: 'mock'
        enumValues: pascal-case#pascalCase
        typename: keep
        terminateCircularRelationships: true
        scalars:
          BaseDateTime:
            generator: date
            arguments: 'YYYY-MM-DD'

Link of issue of another repository that I referred to https://github.com/croutonn/graphql-codegen-plugin-typescript-swr/issues/179

ardeois commented 2 years ago

Thanks for reporting the issue, I've seen this bug too when I tried to use graphql@16 I'll see if I find some time to work on this at the end of the week