Skip to content

Commit ec78195

Browse files
author
wlee221
committed
Specify graphql type where needed
1 parent c700189 commit ec78195

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/api-graphql/src/GraphQLAPI.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
import { GraphQLError } from 'graphql/error/GraphQLError';
1414
// @ts-ignore
15-
import { OperationDefinitionNode } from 'graphql/language';
15+
import { DocumentNode, OperationDefinitionNode } from 'graphql/language';
1616
import { print } from 'graphql/language/printer';
1717
import { parse } from 'graphql/language/parser';
1818
import Observable from 'zen-observable-ts';
@@ -203,9 +203,10 @@ export class GraphQLAPIClass {
203203
*/
204204
getGraphqlOperationType(operation) {
205205
const doc = parse(operation);
206-
const {
207-
definitions: [{ operation: operationType }],
208-
} = doc;
206+
const definitions = doc.definitions as ReadonlyArray<
207+
OperationDefinitionNode
208+
>;
209+
const [{ operation: operationType }] = definitions;
209210

210211
return operationType;
211212
}
@@ -294,7 +295,7 @@ export class GraphQLAPIClass {
294295
};
295296

296297
const body = {
297-
query: print(query),
298+
query: print(query as DocumentNode),
298299
variables,
299300
};
300301

@@ -389,7 +390,7 @@ export class GraphQLAPIClass {
389390
appSyncGraphqlEndpoint,
390391
authenticationType,
391392
apiKey,
392-
query: print(query),
393+
query: print(query as DocumentNode),
393394
region,
394395
variables,
395396
graphql_headers,

0 commit comments

Comments
 (0)