diff --git a/examples/typescript-typed-document-node.ts b/examples/typescript-typed-document-node.ts index 6ba92aaa2..c165930a7 100644 --- a/examples/typescript-typed-document-node.ts +++ b/examples/typescript-typed-document-node.ts @@ -5,7 +5,7 @@ import { parse } from 'graphql' { const endpoint = `https://graphql-yoga.com/api/graphql` - const query: TypedDocumentNode<{ greetings: string }, never | Record> = parse(gql` + const query: TypedDocumentNode<{ greetings: string }, Record> = parse(gql` query greetings { greetings } @@ -23,7 +23,7 @@ import { parse } from 'graphql' const client = new GraphQLClient(endpoint) - const query: TypedDocumentNode<{ greetings: string }, never | Record> = parse(gql` + const query: TypedDocumentNode<{ greetings: string }, Record> = parse(gql` query greetings { greetings } diff --git a/src/resolveRequestDocument.ts b/src/resolveRequestDocument.ts index 6d73cc3a6..e6369e6ff 100644 --- a/src/resolveRequestDocument.ts +++ b/src/resolveRequestDocument.ts @@ -1,10 +1,11 @@ import type { RequestDocument } from './types.js' /** * Refactored imports from `graphql` to be more specific, this helps import only the required files (100KiB) - * instead of the entire package (>500KiB) where tree-shaking is not supported. + * instead of the entire package (greater than 500KiB) where tree-shaking is not supported. * @see https://github.com/jasonkuhrt/graphql-request/pull/543 */ import type { DocumentNode, OperationDefinitionNode } from 'graphql/language/ast.js' +import { Kind } from 'graphql/language/kinds.js' import { parse } from 'graphql/language/parser.js' import { print } from 'graphql/language/printer.js' @@ -16,7 +17,7 @@ const extractOperationName = (document: DocumentNode): string | undefined => { let operationName = undefined const operationDefinitions = document.definitions.filter( - (definition) => definition.kind === `OperationDefinition`, + (definition) => definition.kind === Kind.OPERATION_DEFINITION, ) as OperationDefinitionNode[] if (operationDefinitions.length === 1) {