@@ -73,8 +73,7 @@ export type GraphQLType =
73
73
| GraphQLInterfaceType
74
74
| GraphQLUnionType
75
75
| GraphQLEnumType
76
- | GraphQLInputObjectType
77
- | GraphQLList < GraphQLType >
76
+ | GraphQLList < GraphQLOutputType >
78
77
> ;
79
78
80
79
export function isType ( type : unknown ) : type is GraphQLType {
@@ -213,24 +212,15 @@ export function assertNonNullType(type: unknown): GraphQLNonNull<GraphQLType> {
213
212
return type ;
214
213
}
215
214
216
- export function isSemanticNonNullType (
217
- type : GraphQLInputType ,
218
- ) : type is GraphQLSemanticNonNull < GraphQLInputType > ;
219
- export function isSemanticNonNullType (
220
- type : GraphQLOutputType ,
221
- ) : type is GraphQLSemanticNonNull < GraphQLOutputType > ;
222
- export function isSemanticNonNullType (
223
- type : unknown ,
224
- ) : type is GraphQLSemanticNonNull < GraphQLType > ;
225
215
export function isSemanticNonNullType (
226
216
type : unknown ,
227
- ) : type is GraphQLSemanticNonNull < GraphQLType > {
217
+ ) : type is GraphQLSemanticNonNull < GraphQLNullableType & GraphQLOutputType > {
228
218
return instanceOf ( type , GraphQLSemanticNonNull ) ;
229
219
}
230
220
231
221
export function assertSemanticNonNullType (
232
222
type : unknown ,
233
- ) : GraphQLSemanticNonNull < GraphQLType > {
223
+ ) : GraphQLSemanticNonNull < GraphQLNullableType & GraphQLOutputType > {
234
224
if ( ! isSemanticNonNullType ( type ) ) {
235
225
throw new Error (
236
226
`Expected ${ inspect ( type ) } to be a GraphQL Semantic-Non-Null type.` ,
@@ -485,7 +475,9 @@ export class GraphQLNonNull<T extends GraphQLNullableType> {
485
475
*
486
476
* @experimental
487
477
*/
488
- export class GraphQLSemanticNonNull < T extends GraphQLNullableType > {
478
+ export class GraphQLSemanticNonNull <
479
+ T extends GraphQLNullableType & GraphQLOutputType ,
480
+ > {
489
481
readonly ofType : T ;
490
482
491
483
constructor ( ofType : T ) {
@@ -516,8 +508,8 @@ export class GraphQLSemanticNonNull<T extends GraphQLNullableType> {
516
508
517
509
export type GraphQLWrappingType =
518
510
| GraphQLList < GraphQLType >
519
- | GraphQLNonNull < GraphQLType >
520
- | GraphQLSemanticNonNull < GraphQLType > ;
511
+ | GraphQLNonNull < GraphQLNullableType >
512
+ | GraphQLSemanticNonNull < GraphQLNullableType & GraphQLOutputType > ;
521
513
522
514
export function isWrappingType ( type : unknown ) : type is GraphQLWrappingType {
523
515
return isListType ( type ) || isNonNullType ( type ) || isSemanticNonNullType ( type ) ;
@@ -555,7 +547,10 @@ export function assertNullableType(type: unknown): GraphQLNullableType {
555
547
556
548
export function getNullableType ( type : undefined | null ) : void ;
557
549
export function getNullableType < T extends GraphQLNullableType > (
558
- type : T | GraphQLNonNull < T > | GraphQLSemanticNonNull < T > ,
550
+ type :
551
+ | T
552
+ | GraphQLNonNull < T >
553
+ | GraphQLSemanticNonNull < T extends GraphQLOutputType ? T : never > ,
559
554
) : T ;
560
555
export function getNullableType (
561
556
type : Maybe < GraphQLType > ,
0 commit comments