Skip to content

Commit d6298a3

Browse files
authoredOct 30, 2023
fix: refactor code so linter no longer produces warnings (#605)
1 parent 0d72c58 commit d6298a3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
 

‎examples/typescript-typed-document-node.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { parse } from 'graphql'
55
{
66
const endpoint = `https://graphql-yoga.com/api/graphql`
77

8-
const query: TypedDocumentNode<{ greetings: string }, never | Record<any, never>> = parse(gql`
8+
const query: TypedDocumentNode<{ greetings: string }, Record<any, never>> = parse(gql`
99
query greetings {
1010
greetings
1111
}
@@ -23,7 +23,7 @@ import { parse } from 'graphql'
2323

2424
const client = new GraphQLClient(endpoint)
2525

26-
const query: TypedDocumentNode<{ greetings: string }, never | Record<any, never>> = parse(gql`
26+
const query: TypedDocumentNode<{ greetings: string }, Record<any, never>> = parse(gql`
2727
query greetings {
2828
greetings
2929
}

‎src/resolveRequestDocument.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import type { RequestDocument } from './types.js'
22
/**
33
* Refactored imports from `graphql` to be more specific, this helps import only the required files (100KiB)
4-
* instead of the entire package (>500KiB) where tree-shaking is not supported.
4+
* instead of the entire package (greater than 500KiB) where tree-shaking is not supported.
55
* @see https://github.com/jasonkuhrt/graphql-request/pull/543
66
*/
77
import type { DocumentNode, OperationDefinitionNode } from 'graphql/language/ast.js'
8+
import { Kind } from 'graphql/language/kinds.js'
89
import { parse } from 'graphql/language/parser.js'
910
import { print } from 'graphql/language/printer.js'
1011

@@ -16,7 +17,7 @@ const extractOperationName = (document: DocumentNode): string | undefined => {
1617
let operationName = undefined
1718

1819
const operationDefinitions = document.definitions.filter(
19-
(definition) => definition.kind === `OperationDefinition`,
20+
(definition) => definition.kind === Kind.OPERATION_DEFINITION,
2021
) as OperationDefinitionNode[]
2122

2223
if (operationDefinitions.length === 1) {

0 commit comments

Comments
 (0)
Please sign in to comment.