@@ -129,7 +129,7 @@ export interface ParseOptions {
129
129
*/
130
130
export function parse (
131
131
source : string | Source ,
132
- options ?: ParseOptions ,
132
+ options ?: ParseOptions | undefined ,
133
133
) : DocumentNode {
134
134
const parser = new Parser ( source , options ) ;
135
135
return parser . parseDocument ( ) ;
@@ -147,7 +147,7 @@ export function parse(
147
147
*/
148
148
export function parseValue (
149
149
source : string | Source ,
150
- options ?: ParseOptions ,
150
+ options ?: ParseOptions | undefined ,
151
151
) : ValueNode {
152
152
const parser = new Parser ( source , options ) ;
153
153
parser . expectToken ( TokenKind . SOF ) ;
@@ -162,7 +162,7 @@ export function parseValue(
162
162
*/
163
163
export function parseConstValue (
164
164
source : string | Source ,
165
- options ?: ParseOptions ,
165
+ options ?: ParseOptions | undefined ,
166
166
) : ConstValueNode {
167
167
const parser = new Parser ( source , options ) ;
168
168
parser . expectToken ( TokenKind . SOF ) ;
@@ -183,7 +183,7 @@ export function parseConstValue(
183
183
*/
184
184
export function parseType (
185
185
source : string | Source ,
186
- options ?: ParseOptions ,
186
+ options ?: ParseOptions | undefined ,
187
187
) : TypeNode {
188
188
const parser = new Parser ( source , options ) ;
189
189
parser . expectToken ( TokenKind . SOF ) ;
@@ -204,10 +204,10 @@ export function parseType(
204
204
* @internal
205
205
*/
206
206
export class Parser {
207
- protected _options : Maybe < ParseOptions > ;
207
+ protected _options : ParseOptions ;
208
208
protected _lexer : Lexer ;
209
209
210
- constructor ( source : string | Source , options ? : ParseOptions ) {
210
+ constructor ( source : string | Source , options : ParseOptions = { } ) {
211
211
const sourceObj = isSource ( source ) ? source : new Source ( source ) ;
212
212
213
213
this . _lexer = new Lexer ( sourceObj ) ;
@@ -472,7 +472,7 @@ export class Parser {
472
472
parseNullabilityAssertion ( ) : NullabilityAssertionNode | undefined {
473
473
// Note: Client Controlled Nullability is experimental and may be changed or
474
474
// removed in the future.
475
- if ( this . _options ? .experimentalClientControlledNullability !== true ) {
475
+ if ( this . _options . experimentalClientControlledNullability !== true ) {
476
476
return undefined ;
477
477
}
478
478
@@ -575,7 +575,7 @@ export class Parser {
575
575
// Legacy support for defining variables within fragments changes
576
576
// the grammar of FragmentDefinition:
577
577
// - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet
578
- if ( this . _options ? .allowLegacyFragmentVariables === true ) {
578
+ if ( this . _options . allowLegacyFragmentVariables === true ) {
579
579
return this . node < FragmentDefinitionNode > ( start , {
580
580
kind : Kind . FRAGMENT_DEFINITION ,
581
581
name : this . parseFragmentName ( ) ,
@@ -1455,7 +1455,7 @@ export class Parser {
1455
1455
startToken : Token ,
1456
1456
node : T ,
1457
1457
) : T {
1458
- if ( this . _options ? .noLocation !== true ) {
1458
+ if ( this . _options . noLocation !== true ) {
1459
1459
node . loc = new Location (
1460
1460
startToken ,
1461
1461
this . _lexer . lastToken ,
0 commit comments