UNPKG

851 BTypeScriptView Raw
1import { DocumentNode, ExecutableDefinitionNode } from '../language/ast';
2
3/**
4 * Wrapper type that contains DocumentNode and types that can be deduced from it.
5 */
6export interface TypedQueryDocumentNode<
7 TResponseData = Record<string, any>,
8 TRequestVariables = Record<string, any>
9> extends DocumentNode {
10 readonly definitions: ReadonlyArray<ExecutableDefinitionNode>;
11 // FIXME: remove once TS implements proper way to enforce nominal typing
12 /**
13 * This type is used to ensure that the variables you pass in to the query are assignable to Variables
14 * and that the Result is assignable to whatever you pass your result to. The method is never actually
15 * implemented, but the type is valid because we list it as optional
16 */
17 __ensureTypesOfVariablesAndResultMatching?: (
18 variables: TRequestVariables,
19 ) => TResponseData;
20}