File tree Expand file tree Collapse file tree 4 files changed +6
-7
lines changed Expand file tree Collapse file tree 4 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ exports[`parse > parses the kitchen sink document like graphql.js does 1`] = `
185
185
" selectionSet" : undefined ,
186
186
},
187
187
{
188
- " arguments" : [] ,
188
+ " arguments" : undefined ,
189
189
" directives" : [
190
190
{
191
191
" arguments" : [],
@@ -645,8 +645,7 @@ exports[`parse > parses the kitchen sink document like graphql.js does 1`] = `
645
645
" value" : {
646
646
" block" : true ,
647
647
" kind" : " StringValue" ,
648
- " value" : " block string uses " " "
649
- " ,
648
+ " value" : " block string uses " " " " ,
650
649
},
651
650
},
652
651
],
Original file line number Diff line number Diff line change @@ -188,11 +188,10 @@ export type FragmentSpreadNode = Or<
188
188
{
189
189
readonly kind : Kind . FRAGMENT_SPREAD ;
190
190
readonly name : NameNode ;
191
- readonly arguments ?: ReadonlyArray < ArgumentNode > ;
192
191
readonly directives ?: ReadonlyArray < DirectiveNode > ;
193
192
readonly loc ?: Location ;
194
193
}
195
- > ;
194
+ > & { readonly arguments ?: ReadonlyArray < ArgumentNode > } ;
196
195
197
196
export type InlineFragmentNode = Or <
198
197
GraphQL . InlineFragmentNode ,
Original file line number Diff line number Diff line change @@ -324,7 +324,7 @@ function fragmentSpread(): ast.FragmentSpreadNode | ast.InlineFragmentNode | und
324
324
kind : 'FragmentSpread' as Kind . FRAGMENT_SPREAD ,
325
325
name : _name ,
326
326
directives : directives ( false ) ,
327
- arguments : _arguments ,
327
+ arguments : _arguments . length ? _arguments : undefined ,
328
328
} ;
329
329
} else {
330
330
idx = _idx ;
Original file line number Diff line number Diff line change @@ -97,7 +97,8 @@ const nodes: {
97
97
} ,
98
98
FragmentSpread ( node ) {
99
99
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 ( ', ' ) + ')' ;
101
102
if ( hasItems ( node . directives ) ) out += ' ' + node . directives . map ( nodes . Directive ! ) . join ( ' ' ) ;
102
103
return out ;
103
104
} ,
You can’t perform that action at this time.
0 commit comments