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
Documentation and dynamic cache control feature of Apollo leverages incompatible GraphQl type interface. #7845
Comments
Follow up on this. We dug some more and uncovered this section of the documentation which mentions:
So I guess my request would be that the other locations in the Apollo documentation that mention If the docs are open source, I could also propose a PR that does that if needed. |
Good catch — the TS-specific improvements from AS4 didn't make it to that page. If you'd like to submit a PR, the file is https://github.com/apollographql/apollo-server/blob/main/docs/source/performance/caching.md |
Created the following docs PR, |
…#7848) ## Background / Context Fixes #7845 ## Goals - Ensure documentation of accessing the extended `cacheControl` information on GraphQL's info object does not contain any TypeScript errors ## Changes - Added import statements to the code examples for `import { cacheControlFromInfo } from '@apollo/cache-control-types'` - Leverage `cacheControlFromInfo` in code examples - Updated description of what provides `info.cacheControl` to reference the documentation for the cache control plugin
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue Description
The ApolloServer documentation provides an example of setting cache-control information for a resolver dynamically. This example works in code, but it has a TypeScript error.
The
info
object leverages the type ofGraphQLResolveInfo
. This type does not have acacheControl
field defined on it.I am not sure if this is an error with the
graphql
package and its types, or if its something@apollo/server
and other third party libraries liketyped-graphql
are just expanding the existing GraphQl object with.I was hoping a maintainer of
@apollo/server
would be familiar with how this field works and were the hang up is. Is it safe to follow the documentation's example? Should I just be altering the GraphQl librariesGraphQLResolveInfo
type?Link to Reproduction
Reproduction link
Reproduction Steps
Just launch the repro link and view the fact the type information does not exist for
cacheControl
.The text was updated successfully, but these errors were encountered: