Graphql Code Generator typescript operations plugin generates wrong types

3.2k Views Asked by At

I am using the graphql code generator with the typescript operations plugin to generate typescript types from my GraphQL schema. Everything was working fine until all of a sudden, when i run graphql-codegen --config codegen.yml the types generated were wrong.

The following image is from the file graphql.tsx where I keep all the generated types. image

Here you can also see that the graphql.tsx file has 145 problems. After a quick word search on that file I found out that the typescript utility type Pick is present 145 times. So the problem shown in the image, happens for every Pick type in the file. I think the Pick types are generated by the typescript operations plugin.

When i run graphql-codegen --config codegen.yml I gen no errors.

Everything on the GraphQL Playground at localhost:4000/graphql is woking fine.

My codegen.yml file:

overwrite: true
schema: "http://localhost:4000/graphql"
documents: "src/graphql/**/**/*.graphql"
generates:
  src/generated/graphql.tsx:
    plugins:
      - "typescript"
      - "typescript-operations"
      - "typescript-react-apollo"

What might be causing this problem.

Any help would be appreciated.

0

There are 0 best solutions below