graphql-typed-document-node
graphql-typed-document-node copied to clipboard
use TypedDocumentNode from graphql-js
TypedDocumentNode type landed in graphql-js a while ago: https://github.com/graphql/graphql-js/pull/2749
since codegen (and probably some early adaptor lib authors) use this module as a source for the TypeDocumentNode type, we now end up with 2 interfaces. can this package reexport the interface from graphql-js? (and maybe deprecate this package)
Thank you @backbone87 for reporting this. You are right, this was introduced, but we can't change it at the moment in this package, since it will drop support for previous GraphQL versions for all libraries that are using it. I think, with time, we can gradually move it when v15/v16 becomes more popular.
hm, is there a way to dynamically check what graphql peer version is installed?
hm, is there a way to dynamically check what graphql peer version is installed?
At the moment, no. Btw, You should be able to modify the import path of the typed DocumentNode
, but note that it's not the issue here, since changing it still requires all libraries that support it to adjust and use the one from graphql-js
.
Just chiming in that I am interested in the same. @dotansimha's comment on this PR was spot-on:
Also, graphql-js is used by many projects locally, and execute sometimes is being executed directly with an operation that has been declared locally.
I am using graphql-js
to execute documents in my API tests - it would be a big benefit to get type features on the results.
To clarify: I am able to use the DocumentNode
that is generated by graphql-codegen
in the input - I suspect this is the "built-in" support that is referred to in the README - but the result object retains an unknown
type so we can't benefit from type hinting.
I'm on graphql-js 16.6.0
and @graphql-codegen/typed-document-node 2.3.3
- ~so perhaps I just need to upgrade to [email protected]~ wait - my actual package versions are:
@graphql-codegen/cli: 2.12.0
@graphql-codegen/typescript: 2.7.3
@graphql-codegen/typescript-operations: 2.5.3
@graphql-codegen/typed-document-node: 2.3.3
graphql: 16.6.0
These are all the latest versions. It seems like the only issue remaining is that graphql
won't use the TypedDocumentNode