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.

DocumentNode is unused

See original GitHub issue

In the generated output when using queries with Apollo Client 3, the DocumentNode import is generated but unused.

import { DocumentNode } from 'graphql';

This is my codegen.yml

overwrite: true
schema:
  - 'url'
documents: 'src/graphql/*.graphql'
generates:
  ./src/generated/typed-document-nodes.ts:
    plugins:
      - typescript
      - typescript-operations
      - typed-document-node

Will this import be used for other operations?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dotansimhacommented, Aug 2, 2020

Fixed in: https://github.com/dotansimha/graphql-code-generator/pull/4462 Will be available with the next release of codegen 😃

1reaction
dotansimhacommented, Jul 29, 2020

@ryands17 yeah, see https://github.com/dotansimha/graphql-typed-document-node/issues/15 . in case variables object isn’t correct, it does a fallback to any and allow non-typed usage (happens because of the overloaded method). Also, this solution requires you to set types (and lose the auto-detection of types in TS compiler, you’ll have to specify all @types/... packages manually).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Refetching queries in Apollo Client - Apollo GraphQL Docs
Each element can be either a query's string name or a DocumentNode object. Analogous to the options.refetchQueries array for mutations. Pass "active" (or...
Read more >
TypedDocumentNode: the next generation of GraphQL and ...
TypedDocumentNode is a great solution for having pre-compiled ( DocumentNode ) GraphQL operations with built-in support for TypeScript types.
Read more >
passed to parser was not a valid GraphQL DocumentNode ...
You're calling the graphql function twice -- once in your definition of listMessages and createMessage and then again in your export ...
Read more >
Typed Document Node - Episode #41 - graphql.wtf
A DocumentNode is a GraphQL operation AST that can be used interchangable with any GraphQL client that supports it.
Read more >
DocumentNode in HtmlAgilityPack. Shouldn't SelectNodes ...
To access the page information, I used this code. The website has now changed, though, and my application now gives a null error.......
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