File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import type { RequestDocument } from './types.js'
66 * instead of the entire package (greater than 500KiB) where tree-shaking is not supported.
77 * @see https://github.com/jasonkuhrt/graphql-request/pull/543
88 */
9- import { type DocumentNode , OperationTypeNode } from 'graphql'
9+ import type { DocumentNode } from 'graphql'
1010import { parse } from 'graphql'
1111import { print } from 'graphql'
1212
@@ -32,7 +32,11 @@ const extractIsMutation = (document: DocumentNode): boolean => {
3232 const defs = document . definitions . filter ( isOperationDefinitionNode )
3333
3434 if ( defs . length === 1 ) {
35- isMutation = defs [ 0 ] ! . operation === OperationTypeNode . MUTATION
35+ /* eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison --
36+ * graphql@15's `OperationTypeNode` is a type, but graphql@16's `OperationTypeNode` is a native TypeScript enum
37+ * Therefore, we cannot use `OperationTypeNode.MUTATION` here because it wouldn't work with graphql@15
38+ **/
39+ isMutation = defs [ 0 ] ! . operation === `mutation`
3640 }
3741
3842 return isMutation
You can’t perform that action at this time.
0 commit comments