dotansimha / dotansimha/graphql-code-generator

Unable to generate a typescript file for react-query with graphql-request.

Open
#8,512 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Describe the bug

while generating with config(attached below) got this

✔ Parse Configuration
⚠ Generate outputs
❯ Generate to ./src/gen.ts
✔ Load GraphQL schemas
✔ Load GraphQL documents
✖ Cannot read properties of undefined (reading 'value')
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

### Your Example Website or App

https://codesandbox.io/p/sandbox/dreamy-napier-8pwh9o?file=%2Fpages%2Findex.tsx&selection=%5B%7B%22endColumn%22%3A35%2C%22endLineNumber%22%3A10%2C%22startColumn%22%3A35%2C%22startLineNumber%22%3A10%7D%5D

### Steps to Reproduce the Bug or Issue

step1:
Go to the code sandbox link.
step2:
Open terminal
step3:
Run ( yarn genGQL)

### Expected behavior

it should have created a gen.ts file in the src directory with types and a useSearchAnime hook,
but I got an error message at generating section saying

`✖ Cannot read properties of undefined (reading 'value')`
`error Command failed with exit code 1.`

and there is no stack trace

### Screenshots or Videos

Screenshot 2022-10-23 040849

### Platform

- OS: [Windows]
- NodeJS: [v16.16.0]
- `graphql` version: [16.6.0]
- `@graphql-codegen/*` version(s):
- ["@graphql-codegen/cli": "2.13.7",
"@graphql-codegen/client-preset": "1.1.0",
"@graphql-codegen/typescript": "^2.7.5",
"@graphql-codegen/typescript-operations": "^2.5.5",
"@graphql-codegen/typescript-react-query": "^4.0.3" ]

### Codegen Config File

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

const config: CodegenConfig = {
overwrite: true,
schema: "https://graphql.anilist.co",
documents: "./src/**/*.graphql",
generates: {
"./src/gen.ts": {
plugins: [
"typescript",
"typescript-operations",
"typescript-react-query",
],
config: {
fetcher: "graphql-request",
},
},
},
};

export default config;
`

### Additional context

original project :- https://github.com/SubratKumarGupta/3by3

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.