From 39a6d160849491ee750402851f4be8a8db7c5598 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Sat, 6 Jun 2020 18:31:57 +0300 Subject: [PATCH] TS: sync TS typings with Flow typings extracted from #2609 --- src/language/lexer.d.ts | 6 ++++++ src/type/definition.d.ts | 2 +- src/type/schema.d.ts | 2 +- src/utilities/getIntrospectionQuery.d.ts | 2 +- src/validation/rules/KnownTypeNamesRule.d.ts | 6 ++++-- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/language/lexer.d.ts b/src/language/lexer.d.ts index 92484b6ccd..40dbf9a6b2 100644 --- a/src/language/lexer.d.ts +++ b/src/language/lexer.d.ts @@ -1,5 +1,6 @@ import { Token } from './ast'; import { Source } from './source'; +import { TokenKindEnum } from './tokenKind'; /** * Given a Source object, this returns a Lexer for that source. @@ -50,3 +51,8 @@ export class Lexer { * @internal */ export function isPunctuatorToken(token: Token): boolean; + +/** + * @internal + */ +export function isPunctuatorTokenKind(kind: TokenKindEnum): boolean; diff --git a/src/type/definition.d.ts b/src/type/definition.d.ts index 2c1d55f723..7036861aab 100644 --- a/src/type/definition.d.ts +++ b/src/type/definition.d.ts @@ -335,7 +335,7 @@ export interface GraphQLScalarTypeConfig { description?: Maybe; specifiedByUrl?: Maybe; // Serializes an internal value to include in a response. - serialize: GraphQLScalarSerializer; + serialize?: GraphQLScalarSerializer; // Parses an externally provided value to use as an input. parseValue?: GraphQLScalarValueParser; // Parses an externally provided literal value to use as an input. diff --git a/src/type/schema.d.ts b/src/type/schema.d.ts index ab71fdc0b3..1ae844362a 100644 --- a/src/type/schema.d.ts +++ b/src/type/schema.d.ts @@ -111,7 +111,7 @@ export interface GraphQLSchemaValidationOptions { export interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions { description?: Maybe; - query: Maybe; + query?: Maybe; mutation?: Maybe; subscription?: Maybe; types?: Maybe>; diff --git a/src/utilities/getIntrospectionQuery.d.ts b/src/utilities/getIntrospectionQuery.d.ts index 48ca92a4bf..b1822168ec 100644 --- a/src/utilities/getIntrospectionQuery.d.ts +++ b/src/utilities/getIntrospectionQuery.d.ts @@ -5,7 +5,7 @@ import { DirectiveLocationEnum } from '../language/directiveLocation'; export interface IntrospectionOptions { // Whether to include descriptions in the introspection result. // Default: true - descriptions: boolean; + descriptions?: boolean; // Whether to include `specifiedByUrl` in the introspection result. // Default: false diff --git a/src/validation/rules/KnownTypeNamesRule.d.ts b/src/validation/rules/KnownTypeNamesRule.d.ts index 6c4560e787..b7cd75d4a1 100644 --- a/src/validation/rules/KnownTypeNamesRule.d.ts +++ b/src/validation/rules/KnownTypeNamesRule.d.ts @@ -1,5 +1,5 @@ import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; +import { ValidationContext, SDLValidationContext } from '../ValidationContext'; /** * Known type names @@ -7,4 +7,6 @@ import { ValidationContext } from '../ValidationContext'; * A GraphQL document is only valid if referenced types (specifically * variable definitions and fragment conditions) are defined by the type schema. */ -export function KnownTypeNamesRule(context: ValidationContext): ASTVisitor; +export function KnownTypeNamesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor;