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'
6
6
* instead of the entire package (greater than 500KiB) where tree-shaking is not supported.
7
7
* @see https://github.com/jasonkuhrt/graphql-request/pull/543
8
8
*/
9
- import { type DocumentNode , OperationTypeNode } from 'graphql'
9
+ import type { DocumentNode } from 'graphql'
10
10
import { parse } from 'graphql'
11
11
import { print } from 'graphql'
12
12
@@ -32,7 +32,11 @@ const extractIsMutation = (document: DocumentNode): boolean => {
32
32
const defs = document . definitions . filter ( isOperationDefinitionNode )
33
33
34
34
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`
36
40
}
37
41
38
42
return isMutation
You can’t perform that action at this time.
0 commit comments