@@ -129,7 +129,7 @@ export interface ParseOptions {
129129 */
130130export function parse (
131131 source : string | Source ,
132- options ?: ParseOptions ,
132+ options ?: ParseOptions | undefined ,
133133) : DocumentNode {
134134 const parser = new Parser ( source , options ) ;
135135 return parser . parseDocument ( ) ;
@@ -147,7 +147,7 @@ export function parse(
147147 */
148148export function parseValue (
149149 source : string | Source ,
150- options ?: ParseOptions ,
150+ options ?: ParseOptions | undefined ,
151151) : ValueNode {
152152 const parser = new Parser ( source , options ) ;
153153 parser . expectToken ( TokenKind . SOF ) ;
@@ -162,7 +162,7 @@ export function parseValue(
162162 */
163163export function parseConstValue (
164164 source : string | Source ,
165- options ?: ParseOptions ,
165+ options ?: ParseOptions | undefined ,
166166) : ConstValueNode {
167167 const parser = new Parser ( source , options ) ;
168168 parser . expectToken ( TokenKind . SOF ) ;
@@ -183,7 +183,7 @@ export function parseConstValue(
183183 */
184184export function parseType (
185185 source : string | Source ,
186- options ?: ParseOptions ,
186+ options ?: ParseOptions | undefined ,
187187) : TypeNode {
188188 const parser = new Parser ( source , options ) ;
189189 parser . expectToken ( TokenKind . SOF ) ;
@@ -204,10 +204,10 @@ export function parseType(
204204 * @internal
205205 */
206206export class Parser {
207- protected _options : Maybe < ParseOptions > ;
207+ protected _options : ParseOptions ;
208208 protected _lexer : Lexer ;
209209
210- constructor ( source : string | Source , options ? : ParseOptions ) {
210+ constructor ( source : string | Source , options : ParseOptions = { } ) {
211211 const sourceObj = isSource ( source ) ? source : new Source ( source ) ;
212212
213213 this . _lexer = new Lexer ( sourceObj ) ;
@@ -472,7 +472,7 @@ export class Parser {
472472 parseNullabilityAssertion ( ) : NullabilityAssertionNode | undefined {
473473 // Note: Client Controlled Nullability is experimental and may be changed or
474474 // removed in the future.
475- if ( this . _options ? .experimentalClientControlledNullability !== true ) {
475+ if ( this . _options . experimentalClientControlledNullability !== true ) {
476476 return undefined ;
477477 }
478478
@@ -575,7 +575,7 @@ export class Parser {
575575 // Legacy support for defining variables within fragments changes
576576 // the grammar of FragmentDefinition:
577577 // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet
578- if ( this . _options ? .allowLegacyFragmentVariables === true ) {
578+ if ( this . _options . allowLegacyFragmentVariables === true ) {
579579 return this . node < FragmentDefinitionNode > ( start , {
580580 kind : Kind . FRAGMENT_DEFINITION ,
581581 name : this . parseFragmentName ( ) ,
@@ -1455,7 +1455,7 @@ export class Parser {
14551455 startToken : Token ,
14561456 node : T ,
14571457 ) : T {
1458- if ( this . _options ? .noLocation !== true ) {
1458+ if ( this . _options . noLocation !== true ) {
14591459 node . loc = new Location (
14601460 startToken ,
14611461 this . _lexer . lastToken ,
0 commit comments