import type { DocumentNode } from "graphql"; export interface DocumentTypeDecoration { /** * This type is used to ensure that the variables you pass in to the query are assignable to Variables * and that the Result is assignable to whatever you pass your result to. The method is never actually * implemented, but the type is valid because we list it as optional */ __apiType?: (variables: TVariables) => TResult; } export interface TypedDocumentNode extends DocumentNode, DocumentTypeDecoration { } /** * Helper for extracting a TypeScript type for operation result from a TypedDocumentNode and TypedDocumentString. * @example * const myQuery = { ... }; // TypedDocumentNode * type ResultType = ResultOf; // Now it's R */ export type ResultOf = T extends DocumentTypeDecoration ? ResultType : never; /** * Helper for extracting a TypeScript type for operation variables from a TypedDocumentNode and TypedDocumentString. * @example * const myQuery = { ... }; // TypedDocumentNode * type VariablesType = VariablesOf; // Now it's V */ export type VariablesOf = T extends DocumentTypeDecoration ? VariablesType : never;