@@ -23,7 +23,10 @@ import * as graphql from "graphql";
23
23
type Maybe < T > = null | undefined | T ;
24
24
25
25
// If GraphQL doesn't have this helper function, then it doesn't natively support GraphQLSemanticNonNull
26
- const isSemanticNonNullType =
26
+ const isSemanticNonNullType : (
27
+ t : unknown ,
28
+ ) => t is { ofType : GraphQLNullableType } =
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
30
( graphql as any ) . isSemanticNonNullType ?? ( ( ) => false ) ;
28
31
29
32
function convertSchema ( schema : GraphQLSchema , toStrict : boolean ) {
@@ -103,9 +106,7 @@ function makeConvertType(toStrict: boolean) {
103
106
return type ;
104
107
}
105
108
if ( isSemanticNonNullType ( type ) ) {
106
- const unwrapped = convertType (
107
- ( type as any ) . ofType as GraphQLNullableType ,
108
- ) ;
109
+ const unwrapped = convertType ( type . ofType ) ;
109
110
// Here's where we do our thing!
110
111
if ( toStrict ) {
111
112
return new GraphQLNonNull ( unwrapped ) ;
@@ -195,10 +196,7 @@ export function convertFieldConfig(
195
196
// Strip semantic-non-null types; this should never happen but if someone
196
197
// uses both semantic-non-null and the `@semanticNonNull` directive, we
197
198
// want the directive to win (I guess?)
198
- return recurse (
199
- ( type as any ) . ofType as GraphQLNullableType & GraphQLOutputType ,
200
- level ,
201
- ) ;
199
+ return recurse ( type . ofType , level ) ;
202
200
} else if ( isNonNullType ( type ) ) {
203
201
const inner = recurse ( type . ofType , level ) ;
204
202
if ( isNonNullType ( inner ) ) {
0 commit comments