@@ -424,6 +424,9 @@ function variableDefinitions(): ast.VariableDefinitionNode[] | undefined {
424424 let _description : ast . StringValueNode | undefined ;
425425 if ( input . charCodeAt ( idx ) === 34 /*'"'*/ ) {
426426 _description = value ( true ) as ast . StringValueNode ;
427+ if ( _description . kind !== ( 'StringValue' as Kind . STRING ) ) {
428+ throw error ( 'VariableDefinition' ) ;
429+ }
427430 }
428431 if ( input . charCodeAt ( idx ++ ) !== 36 /*'$'*/ ) throw error ( 'Variable' ) ;
429432 const name = nameNode ( ) ;
@@ -437,7 +440,7 @@ function variableDefinitions(): ast.VariableDefinitionNode[] | undefined {
437440 _defaultValue = value ( true ) ;
438441 }
439442 ignored ( ) ;
440- const varDef : any = {
443+ const varDef : ast . VariableDefinitionNode = {
441444 kind : 'VariableDefinition' as Kind . VARIABLE_DEFINITION ,
442445 variable : {
443446 kind : 'Variable' as Kind . VARIABLE ,
@@ -463,7 +466,7 @@ function fragmentDefinition(description?: ast.StringValueNode): ast.FragmentDefi
463466 if ( input . charCodeAt ( idx ++ ) !== 111 /*'o'*/ || input . charCodeAt ( idx ++ ) !== 110 /*'n'*/ )
464467 throw error ( 'FragmentDefinition' ) ;
465468 ignored ( ) ;
466- const fragDef : any = {
469+ const fragDef : ast . FragmentDefinitionNode = {
467470 kind : 'FragmentDefinition' as Kind . FRAGMENT_DEFINITION ,
468471 name,
469472 typeCondition : {
@@ -503,11 +506,17 @@ function definitions(): ast.DefinitionNode[] {
503506 const definition = name ( ) ;
504507 switch ( definition ) {
505508 case 'fragment' :
509+ if ( _description && _description . kind !== ( 'StringValue' as Kind . STRING ) ) {
510+ throw error ( 'FragmentDefinition' ) ;
511+ }
506512 _definitions . push ( fragmentDefinition ( _description ) ) ;
507513 break ;
508514 case 'query' :
509515 case 'mutation' :
510516 case 'subscription' :
517+ if ( _description && _description . kind !== ( 'StringValue' as Kind . STRING ) ) {
518+ throw error ( 'OperationDefinition' ) ;
519+ }
511520 let char : number ;
512521 let name : ast . NameNode | undefined ;
513522 if (
0 commit comments