Open florisdegraaff opened 1 year ago
Same problem.
Same problem when importing with esm modules. Seems like because GraphQLClientRequestHeaders
isn't exposed in graphql-request
.
Fixed with this:
hooks: {
afterOneFileWrite: [
`sed -i '' -e '1s;^.*;import type { GraphQLClient, RequestOptions } from \"graphql-request\"\\;;' myFile.ts`,
`sed -i '' -e '2s;^.*;export type GraphQLClientRequestHeaders = RequestOptions[\"requestHeaders\"]\\;;' myFile.ts`,
],
},
Extracted the needed type indirectly from RequestOptions
Which packages are impacted by your issue?
No response
Describe the bug
When using the
typescript-graphql-request
plugin I get an import error. Running the code does work, but building the code gives an error. The error will be on the second line, being:import { GraphQLClientRequestHeaders } from 'graphql-request/build/cjs/types';
Your Example Website or App
https://github.com/florisdegraaff/portfolio
Steps to Reproduce the Bug or Issue
Install latest versions of:
@graphql-codegen/cli
@graphql-codegen/fragment-matcher
@graphql-codegen/typescript
@graphql-codegen/typescript-graphql-request
@graphql-codegen/typescript-operations
Setup
codegen.ts
with:Add
.graphql
files that follow the pattern in dedocuments
setting of yourcodegen.ts
Run
graphql-codegen --config codegen.ts
Expected behavior
The import of the
GraphQLClientRequestHeaders
in the generated file should not return an errorScreenshots or Videos
No response
Platform
graphql
version: 16.8.1@graphql-codegen/*
version(s): "@graphql-codegen/add": "^5.0.0", "@graphql-codegen/cli": "^5.0.0", "@graphql-codegen/fragment-matcher": "^5.0.0", "@graphql-codegen/typescript": "^4.0.1", "@graphql-codegen/typescript-graphql-request": "^6.0.0", "@graphql-codegen/typescript-operations": "^4.0.1",Codegen Config File
Additional context
No response