Argument of type 'DocumentNode' is not assignable to parameter of type 'string'.
See original GitHub issueDescribe the bug
As of @graphql-codegen/typescript-graphql-request
3.1.0 generated code no longer calls print
when calling rawRequest
. This breaks the request and tries to send AST instead of the query.
To Reproduce Steps to reproduce the behavior:
https://codesandbox.io/s/suspicious-kirch-bsv3x?file=/types.ts
- My GraphQL schema:
type Query {
user(id: ID!): User!
}
type User {
id: ID!
username: String!
email: String!
}
- My GraphQL operations:
query user {
user(id: 1) {
id
username
}
}
- My
codegen.yml
config file:
schema: schema.graphql
documents: document.graphql
overwrite: true
generates:
types.ts:
config:
rawRequest: true
plugins:
- typescript
- typescript-operations
- typescript-graphql-request
Expected behavior
There are not type errors in types.ts
Environment:
- OS: MacOS 11.2.1
@graphql-codegen/typescript-graphql-request 3.1.0
:- NodeJS: 14.16.0
Additional context https://github.com/dotansimha/graphql-code-generator/pull/5618 https://github.com/dotansimha/graphql-code-generator/issues/5614
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Apollo graphql error Type 'DocumentNode' is not assignable ...
The route works perfectly well inside the graphql playground but in my tests I'm getting the error Type 'DocumentNode' is not assignable to...
Read more >Two different types with this name exist errors due to mismatch ...
We getting following errors, it could be due to @types/graphql happens ... Argument of type 'DocumentNode' is not assignable to parameter of ......
Read more >Issues with TypeScript and resolvers - Help - Apollo GraphQL
This shows the error: Argument of type '() => PrismaPromise<Movie>' is not assignable to parameter of type 'DocumentNode | TypedDocumentNode<any ...
Read more >typed-document-node - GraphQL Code Generator
// Represents the variables type of the operation - generated by `typescript` + `typescript-operations` plugins export type RatesQueryVariables ...
Read more >Error during build of sample Next.js app
... Type error: Argument of type ... language: string; }>>' is not assignable to parameter of type 'string | DocumentNode'.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@dotansimha tested out
@graphql-codegen/typescript-graphql-request@3.1.1-alpha-2d42bf3a.0
and I can confirm that it resolves our issue.@cmonty @bartenra @Inlustra can you please confirm that
@graphql-codegen/typescript-graphql-request@3.1.1-alpha-2d42bf3a.0
fixes that issue?