@@ -109,11 +109,11 @@ function makeConvertType(toStrict: boolean) {
109
109
} else {
110
110
return unwrapped ;
111
111
}
112
- } else if ( type instanceof GraphQLNonNull ) {
112
+ } else if ( isNonNullType ( type ) ) {
113
113
return new GraphQLNonNull (
114
114
convertType ( type . ofType as GraphQLNullableType ) ,
115
115
) ;
116
- } else if ( type instanceof GraphQLList ) {
116
+ } else if ( isListType ( type ) ) {
117
117
return new GraphQLList ( convertType ( type . ofType as GraphQLType ) ) ;
118
118
}
119
119
if ( type . name . startsWith ( "__" ) ) {
@@ -123,21 +123,21 @@ function makeConvertType(toStrict: boolean) {
123
123
return cache . get ( type . name ) ;
124
124
}
125
125
const newType = ( ( ) => {
126
- if ( type instanceof GraphQLObjectType ) {
126
+ if ( isObjectType ( type ) ) {
127
127
const config = type . toConfig ( ) ;
128
128
return new GraphQLObjectType ( {
129
129
...config ,
130
130
fields : convertFields ( config . fields ) ,
131
131
interfaces : convertTypes ( config . interfaces ) ,
132
132
} ) ;
133
- } else if ( type instanceof GraphQLInterfaceType ) {
133
+ } else if ( isInterfaceType ( type ) ) {
134
134
const config = type . toConfig ( ) ;
135
135
return new GraphQLInterfaceType ( {
136
136
...config ,
137
137
fields : convertFields ( config . fields ) ,
138
138
interfaces : convertTypes ( config . interfaces ) ,
139
139
} ) ;
140
- } else if ( type instanceof GraphQLUnionType ) {
140
+ } else if ( isUnionType ( type ) ) {
141
141
const config = type . toConfig ( ) ;
142
142
return new GraphQLUnionType ( {
143
143
...config ,
@@ -203,7 +203,7 @@ export function convertFieldConfig(
203
203
// uses both semantic-non-null and the `@semanticNonNull` directive, we
204
204
// want the directive to win (I guess?)
205
205
return recurse ( type . ofType , level ) ;
206
- } else if ( type instanceof GraphQLNonNull ) {
206
+ } else if ( isNonNullType ( type ) ) {
207
207
const inner = recurse ( type . ofType , level ) ;
208
208
if ( levels . includes ( level ) ) {
209
209
// Semantic non-null from `inner` replaces our GraphQLNonNull wrapper
@@ -212,7 +212,7 @@ export function convertFieldConfig(
212
212
// Keep non-null wrapper; no semantic-non-null was added to `inner`
213
213
return new GraphQLNonNull ( inner ) ;
214
214
}
215
- } else if ( type instanceof GraphQLList ) {
215
+ } else if ( isListType ( type ) ) {
216
216
const inner = new GraphQLList ( recurse ( type . ofType , level + 1 ) ) ;
217
217
if ( levels . includes ( level ) ) {
218
218
return new GraphQLNonNull ( inner ) ;
0 commit comments