Skip to content

Commit 801ef32

Browse files
committed
fix type
1 parent 9acedf8 commit 801ef32

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/__tests__/__snapshots__/parser.test.ts.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,7 @@ exports[`parse > parses the kitchen sink document like graphql.js does 1`] = `
645645
"value": {
646646
"block": true,
647647
"kind": "StringValue",
648-
"value": "block string uses """
649-
",
648+
"value": "block string uses """",
650649
},
651650
},
652651
],

src/ast.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,10 @@ export type FragmentSpreadNode = Or<
188188
{
189189
readonly kind: Kind.FRAGMENT_SPREAD;
190190
readonly name: NameNode;
191-
readonly arguments?: ReadonlyArray<ArgumentNode>;
192191
readonly directives?: ReadonlyArray<DirectiveNode>;
193192
readonly loc?: Location;
194193
}
195-
>;
194+
> & { readonly arguments?: ReadonlyArray<ArgumentNode> };
196195

197196
export type InlineFragmentNode = Or<
198197
GraphQL.InlineFragmentNode,

src/printer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ const nodes: {
9797
},
9898
FragmentSpread(node) {
9999
let out = '...' + node.name.value;
100-
if (hasItems(node.arguments)) out += '(' + node.arguments.map(nodes.Argument!).join(', ') + ')';
100+
if ('arguments' in node && Array.isArray(node.arguments) && hasItems(node.arguments))
101+
out += '(' + node.arguments.map(nodes.Argument!).join(', ') + ')';
101102
if (hasItems(node.directives)) out += ' ' + node.directives.map(nodes.Directive!).join(' ');
102103
return out;
103104
},

0 commit comments

Comments
 (0)