@@ -27,7 +27,6 @@ import {
27
27
type GraphQLNamedType ,
28
28
type GraphQLAbstractType ,
29
29
type GraphQLObjectType ,
30
- isAbstractType ,
31
30
isObjectType ,
32
31
isInterfaceType ,
33
32
isUnionType ,
@@ -202,8 +201,6 @@ export class GraphQLSchema {
202
201
}
203
202
}
204
203
}
205
- } else if ( isAbstractType ( type ) && ! this . _implementations [ type . name ] ) {
206
- this . _implementations [ type . name ] = [ ] ;
207
204
}
208
205
}
209
206
}
@@ -234,24 +231,22 @@ export class GraphQLSchema {
234
231
if ( isUnionType ( abstractType ) ) {
235
232
return abstractType . getTypes ( ) ;
236
233
}
237
- return this . _implementations [ abstractType . name ] ;
234
+ return this . _implementations [ abstractType . name ] || [ ] ;
238
235
}
239
236
240
237
isPossibleType (
241
238
abstractType : GraphQLAbstractType ,
242
239
possibleType : GraphQLObjectType ,
243
240
) : boolean {
244
- const possibleTypeMap = this . _possibleTypeMap ;
245
-
246
- if ( ! possibleTypeMap [ abstractType . name ] ) {
247
- const possibleTypes = this . getPossibleTypes ( abstractType ) ;
248
- possibleTypeMap [ abstractType . name ] = possibleTypes . reduce ( ( map , type ) => {
241
+ if ( this . _possibleTypeMap [ abstractType . name ] == null ) {
242
+ const map = Object . create ( null ) ;
243
+ for ( const type of this . getPossibleTypes ( abstractType ) ) {
249
244
map [ type . name ] = true ;
250
- return map ;
251
- } , Object . create ( null ) ) ;
245
+ }
246
+ this . _possibleTypeMap [ abstractType . name ] = map ;
252
247
}
253
248
254
- return Boolean ( possibleTypeMap [ abstractType . name ] [ possibleType . name ] ) ;
249
+ return Boolean ( this . _possibleTypeMap [ abstractType . name ] [ possibleType . name ] ) ;
255
250
}
256
251
257
252
getDirectives ( ) : $ReadOnlyArray < GraphQLDirective > {
0 commit comments