@@ -214,13 +214,13 @@ export function assertNonNullType(type: unknown): GraphQLNonNull<GraphQLType> {
214214
215215export function isSemanticNonNullType (
216216 type : unknown ,
217- ) : type is GraphQLSemanticNonNull < GraphQLNullableType & GraphQLOutputType > {
217+ ) : type is GraphQLSemanticNonNull < GraphQLNullableOutputType > {
218218 return instanceOf ( type , GraphQLSemanticNonNull ) ;
219219}
220220
221221export function assertSemanticNonNullType (
222222 type : unknown ,
223- ) : GraphQLSemanticNonNull < GraphQLNullableType & GraphQLOutputType > {
223+ ) : GraphQLSemanticNonNull < GraphQLNullableOutputType > {
224224 if ( ! isSemanticNonNullType ( type ) ) {
225225 throw new Error (
226226 `Expected ${ inspect ( type ) } to be a GraphQL Semantic-Non-Null type.` ,
@@ -475,9 +475,7 @@ export class GraphQLNonNull<T extends GraphQLNullableType> {
475475 *
476476 * @experimental
477477 */
478- export class GraphQLSemanticNonNull <
479- T extends GraphQLNullableType & GraphQLOutputType ,
480- > {
478+ export class GraphQLSemanticNonNull < T extends GraphQLNullableOutputType > {
481479 readonly ofType : T ;
482480
483481 constructor ( ofType : T ) {
@@ -509,7 +507,7 @@ export class GraphQLSemanticNonNull<
509507export type GraphQLWrappingType =
510508 | GraphQLList < GraphQLType >
511509 | GraphQLNonNull < GraphQLNullableType >
512- | GraphQLSemanticNonNull < GraphQLNullableType & GraphQLOutputType > ;
510+ | GraphQLSemanticNonNull < GraphQLNullableOutputType > ;
513511
514512export function isWrappingType ( type : unknown ) : type is GraphQLWrappingType {
515513 return isListType ( type ) || isNonNullType ( type ) || isSemanticNonNullType ( type ) ;
@@ -534,6 +532,17 @@ export type GraphQLNullableType =
534532 | GraphQLInputObjectType
535533 | GraphQLList < GraphQLType > ;
536534
535+ /**
536+ * These types can all accept null as a value, and are suitable for output.
537+ */
538+ export type GraphQLNullableOutputType =
539+ | GraphQLScalarType
540+ | GraphQLObjectType
541+ | GraphQLInterfaceType
542+ | GraphQLUnionType
543+ | GraphQLEnumType
544+ | GraphQLList < GraphQLOutputType > ;
545+
537546export function isNullableType ( type : unknown ) : type is GraphQLNullableType {
538547 return isType ( type ) && ! isNonNullType ( type ) && ! isSemanticNonNullType ( type ) ;
539548}
0 commit comments