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`] = `
185185 " selectionSet" : undefined ,
186186 },
187187 {
188- " arguments" : [] ,
188+ " arguments" : undefined ,
189189 " directives" : [
190190 {
191191 " arguments" : [],
@@ -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 ],
Original file line number Diff line number Diff 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
197196export type InlineFragmentNode = Or <
198197 GraphQL . InlineFragmentNode ,
Original file line number Diff line number Diff line change @@ -324,7 +324,7 @@ function fragmentSpread(): ast.FragmentSpreadNode | ast.InlineFragmentNode | und
324324 kind : 'FragmentSpread' as Kind . FRAGMENT_SPREAD ,
325325 name : _name ,
326326 directives : directives ( false ) ,
327- arguments : _arguments ,
327+ arguments : _arguments . length ? _arguments : undefined ,
328328 } ;
329329 } else {
330330 idx = _idx ;
Original file line number Diff line number Diff 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 } ,
You can’t perform that action at this time.
0 commit comments