[typescript-graphql-request] Importing not exported type
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:
- My GraphQL schema:
type Foo {
id: ID!
}
type Query {
foo: Foo!
}
- My GraphQL operations:
query test {
foo {
id
}
}
- My
codegen.ymlconfig 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:
- OS: Windows 10
{
"@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"
}
- NodeJS: 15
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.
https://github.com/prisma-labs/graphql-request/blob/a8d99f5cdbe57786ecb8d99c88175599608d2fc6/src/index.ts#L47
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
Available in the latest release! Thanks!