forked from graphql/graphql-js
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'TypedQueryDocumentNode' TS type (graphql#2749)
- Loading branch information
1 parent
b83a9fe
commit d6be64c
Showing
4 changed files
with
46 additions
and
2 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { DocumentNode, ExecutableDefinitionNode } from '../language/ast'; | ||
|
||
/** | ||
* Wrapper type that contains DocumentNode and types that can be deduced from it. | ||
*/ | ||
interface TypedQueryDocumentNode< | ||
TResponseData = Record<string, any>, | ||
TRequestVariables = Record<string, any> | ||
> extends DocumentNode { | ||
readonly definitions: ReadonlyArray<ExecutableDefinitionNode>; | ||
// FIXME: remove once TS implements proper way to enforce nominal typing | ||
readonly __enforceStructuralTypingOnResponseDataType?: TResponseData; | ||
readonly __enforceStructuralTypingOnRequestVariablesType?: TRequestVariables; | ||
} |