Skip to content

Commit 818849e

Browse files
committed
Fix a few tests
1 parent 17461b9 commit 818849e

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/language/__tests__/predicates-test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ describe('AST node predicates', () => {
9393
'ListType',
9494
'NonNullType',
9595
'SemanticNonNullType',
96+
'SemanticNullableType',
9697
]);
9798
});
9899

src/language/parser.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,25 @@ export class Parser {
788788
type = this.parseNamedType();
789789
}
790790

791+
if (this._options.allowSemanticNullability) {
792+
if (this.expectOptionalToken(TokenKind.BANG)) {
793+
return this.node<NonNullTypeNode>(start, {
794+
kind: Kind.NON_NULL_TYPE,
795+
type,
796+
});
797+
} else if (this.expectOptionalToken(TokenKind.QUESTION_MARK)) {
798+
return this.node<SemanticNullableTypeNode>(start, {
799+
kind: Kind.SEMANTIC_NULLABLE_TYPE,
800+
type,
801+
});
802+
}
803+
804+
return this.node<SemanticNonNullTypeNode>(start, {
805+
kind: Kind.SEMANTIC_NON_NULL_TYPE,
806+
type,
807+
});
808+
}
809+
791810
if (this.expectOptionalToken(TokenKind.BANG)) {
792811
return this.node<NonNullTypeNode>(start, {
793812
kind: Kind.NON_NULL_TYPE,

src/type/__tests__/introspection-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('Introspection', () => {
3232
expect(result).to.deep.equal({
3333
data: {
3434
__schema: {
35-
queryType: { name: 'SomeObject' },
35+
queryType: { kind: 'OBJECT', name: 'SomeObject' },
3636
mutationType: null,
3737
subscriptionType: null,
3838
types: [

0 commit comments

Comments
 (0)