Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.

feat(core): Add support for graphql.js’ built-in TypedQueryDocumentNode (#3085)

Changed files
+13 -2
.changeset
packages
core
src
+5
.changeset/hungry-panthers-fly.md
···
+
---
+
'@urql/core': patch
+
---
+
+
Add support for `graphql`’s built-in `TypedQueryDocumentNode` typings for type inference.
+8 -2
packages/core/src/types.ts
···
-
import type { GraphQLError, DocumentNode } from 'graphql';
+
import type { GraphQLError, DocumentNode, DefinitionNode } from 'graphql';
import { Subscription, Source } from 'wonka';
import { Client } from './client';
import { CombinedError } from './utils/error';
···
Result = { [key: string]: any },
Variables = { [key: string]: any }
> extends DocumentNode {
-
/** Type to check whether `Variables` and `Result` are assignable types.
+
/** GraphQL.js Definition Nodes of the `DocumentNode`. */
+
readonly definitions: ReadonlyArray<DefinitionNode>;
+
/** Type to support `@graphql-typed-document-node/core`
* @internal
*/
__apiType?: (variables: Variables) => Result;
+
/** Type to support `TypedQueryDocumentNode` from `graphql`
+
* @internal
+
*/
+
__ensureTypesOfVariablesAndResultMatching?: (variables: Variables) => Result;
}
/** A list of errors on {@link ExecutionResult | ExecutionResults}.