Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add generics for data and variables to executeOperation (#6960)
This lets you manually specify the these types when calling the method; typically you generate these types with a codegen tool like graphql-code-generator. This matches a common pattern used in client development. This doesn't let you specify the types for incremental delivery responses; we could potentially add that later. This also lets you use TypedQueryDocumentNode (from graphql-js) as the `query`; if you do so, we can infer the two generic types automatically. (This type is less popular than the earlier TypedDocumentNode from `@graphql-typed-document-node/core` and we should probably support the latter as well; in the interest of reducing dependencies we don't yet, but we can extend to support that later.) Adapted from an original PR #6384 by @jacksenior.
- Loading branch information
Showing
5 changed files
with
114 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@apollo/server': patch | ||
--- | ||
|
||
Add generics for response data and variables to server.executeOperation; allow inference from TypedQueryDocumentNode. |
This file contains 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 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 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 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