Describe the bug
typescript-graphql-request generates the following import
import { HeadersInit } from 'graphql-request/dist/types.dom';
HeadersInit is not exported from graphql-request
To Reproduce
Steps to reproduce the behavior:
type Foo {
id: ID!
}
type Query {
foo: Foo!
}
query test {
foo {
id
}
}
codegen.yml config file:schema: ./schema.gql
documents: ./src/**/*.gql
overwrite: true
generates:
./src/index.ts:
plugins:
- typescript
- typescript-operations
- typescript-graphql-request
config:
skipTypename: true
namingConvention:
transformUnderscore: true
Expected behavior
Generate TypeScript code without any errors.
Environment:
{
"@graphql-codegen/cli": "^1.20.1",
"@graphql-codegen/introspection": "^1.18.1",
"@graphql-codegen/typescript": "^1.20.2",
"@graphql-codegen/typescript-graphql-request": "^3.0.1",
"@graphql-codegen/typescript-operations": "^1.17.14",
"graphql-request": "^3.4.0",
"graphql": "^15.5.0"
}
Additional context
It should be
import { RequestInit } from 'graphql-request/dist/types.dom';
The header type should be RequestInit['headers']. That is how the graphql-request defines.
Workaround:
downgrade to "@graphql-codegen/typescript-graphql-request": "^3.0.0"
downgrade to "@graphql-codegen/typescript-graphql-request": "3.0.0"
without the ^ to avoid automatically patching to 3.0.1
Most helpful comment
Workaround:
downgrade to
"@graphql-codegen/typescript-graphql-request": "^3.0.0"