question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Argument of type 'DocumentNode' is not assignable to parameter of type 'string'.

See original GitHub issue

Describe 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

  1. My GraphQL schema:
type Query {
    user(id: ID!): User!
}

type User {
    id: ID!
    username: String!
    email: String!
}
  1. My GraphQL operations:
query user {
    user(id: 1) {
        id
        username
    }
}
  1. 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:closed
  • Created 2 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cmontycommented, Apr 19, 2021

@dotansimha tested out @graphql-codegen/typescript-graphql-request@3.1.1-alpha-2d42bf3a.0 and I can confirm that it resolves our issue.

1reaction
dotansimhacommented, Apr 19, 2021

@cmonty @bartenra @Inlustra can you please confirm that @graphql-codegen/typescript-graphql-request@3.1.1-alpha-2d42bf3a.0 fixes that issue?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found