-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Update TypeScript documentation #12835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
c6a788d
Add note about typescript in queries doc
jerelmiller 80c9200
Update intro section
jerelmiller 4bb918f
Remove sections on render props/hoc
jerelmiller cc31f5a
Assume gql codegen
jerelmiller aeec186
Use npm
jerelmiller ae802ae
Tweak command
jerelmiller 3e84bad
Use note
jerelmiller a606b1a
Update doc blocks on masking types
jerelmiller 78db0c4
1st draft of hkt for masking types
jerelmiller aa0b9e7
2nd draft
jerelmiller b6bfed0
Add note about other type overrides
jerelmiller ccd8678
Update codegen section
jerelmiller 6af9128
Move typed document node up. Add advanced configuration section
jerelmiller c0ef038
Add additional recommended setting
jerelmiller e8fa968
Add notes for TypeScript in queries and getting started
jerelmiller 36e7f03
Fix typo
jerelmiller 56a6073
Tweak sentence
jerelmiller 497af91
Tweak comment
jerelmiller 3fb4c25
Use contraction
jerelmiller 65d9a71
Tweak note
jerelmiller a9c6060
Tweak example
jerelmiller 81ba318
Overhaul typed document node section
jerelmiller 0fdfe7e
Tweak sentence
jerelmiller 73d5ded
Tweak reqs
jerelmiller 70687c6
Add more to variables section
jerelmiller 1966d47
Add section on mutations
jerelmiller d5ae6d4
Show type in example
jerelmiller 9824c04
Add subscriptions section
jerelmiller c1c7dac
Remove imports in example to simplify
jerelmiller b89d54e
Add imports
jerelmiller 1011e27
Fix highlight
jerelmiller 4d36a04
Remove accidental add to wrong section
jerelmiller aba9f52
Update example
jerelmiller 7afcc7f
Add note about HKT
jerelmiller de22455
Add section for adding gql codegen masking types in fragments
jerelmiller 003cda0
Remove Masked/MaskedDocumentNode from list of overridable types
jerelmiller 75da0cc
Rework example for HKT for masking types
jerelmiller f2a9fb1
Add section on providing type overrides
jerelmiller c7b4d45
Add section for defer
jerelmiller 86ade45
Fix typo
jerelmiller f020d76
Update section for client preset
jerelmiller c52ad4f
Add emphasis
jerelmiller 1ca769b
Tweak caution
jerelmiller 71107e9
Split into separate paragraphs
jerelmiller 21259dd
Add generics
jerelmiller c16a124
Move parens to part of other sentence
jerelmiller 25e0eab
Fix typo
jerelmiller 8473df2
AI suggestions
jerelmiller 93908a3
Add note for typescript in mutations doc
jerelmiller 40d46be
Update api report
jerelmiller 13a4b4f
Update size limits
jerelmiller a10f486
Add section for defining context types
jerelmiller 97f66b7
Add link back to TypeScript guide for managing context
jerelmiller 60b1875
Fix typos
jerelmiller 7a1f711
AI suggestions
jerelmiller ae41553
Fix grammar
jerelmiller 674c2e5
Change headlines
jerelmiller 6284ba4
Modify paragraph about defaults
jerelmiller c540604
Merge branch 'release-4.0' into jerel/ts-docs
jerelmiller 16c243a
Clean up Prettier, Size-limit, and Api-Extractor
jerelmiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,12 @@ This article shows how to fetch GraphQL data in React with the `useQuery` hook a | |
|
|
||
| ## Prerequisites | ||
|
|
||
| <Note> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without fully restructuring everything, I figured this was a cheap way to bring attention to the TypeScript guide more up-front. Other ideas welcome. |
||
|
|
||
| If your application is built using TypeScript, we recommend reading the [TypeScript guide](../development-testing/static-typing) to learn how to use TypeScript with Apollo Client. | ||
|
|
||
| </Note> | ||
|
|
||
| This article assumes you're familiar with building basic GraphQL queries. If you need a refresher, we recommend [this guide](http://graphql.org/learn/queries/). You can also build example queries against Apollo's [full-stack tutorial server](https://apollo-fullstack-tutorial.herokuapp.com/graphql). | ||
|
|
||
| This article also assumes that you've already set up Apollo Client and have wrapped your React app in an `ApolloProvider` component. For more information, see the [getting started guide](../get-started/). | ||
|
|
@@ -70,6 +76,12 @@ As our query executes and the values of `loading`, `error`, and `data` change, t | |
|
|
||
| When the user selects a dog breed from the populated dropdown, the selection is sent to the parent component via the provided `onDogSelected` function. | ||
|
|
||
| <Note> | ||
|
|
||
| If you are using TypeScript, `data` is typed as `unknown` when the query type is unknown. Accessing fields on `data` results in a TypeScript error. See the [TypeScript with Apollo Client](../development-testing/static-typing) guide to learn how to add types for your queries. | ||
|
|
||
| </Note> | ||
|
|
||
| In the next step, we'll associate the dropdown with a more sophisticated query that uses GraphQL variables. | ||
|
|
||
| ## Caching query results | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.