apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.34k stars 2.66k forks source link

[Documentation] Improve clarity on `TypedDocumentNode` in the "Using TypeScript" doc #12007

Open jerelmiller opened 1 month ago

jerelmiller commented 1 month ago

Link: https://www.apollographql.com/docs/react/development-testing/static-typing/#using-typeddocumentnode

This section is last in the doc and starts with the phrase:

This technique enables us to modify the useQuery example above to use a type inference:

The sections before it describe usage with the generated gql function created by graphql-codegen, so this statement makes it seem like TypedDocumentNode with the manual typing is something that should be used instead of the generated gql function. If anything, we should consider reversing the sections and start with the manual typing approach followed by graphql codegen to show how types can be improved by automatically generating them.