import { parse } from 'graphql' ; import { GraphQLSchema , GraphQLObjectType , GraphQLNamedType , GraphQLDirective , } from 'graphql/type' ; import { extendSchema } from 'graphql/utilities' ; export type GraphQLSchemaExtConfig = { query : GraphQLObjectType ; mutation ? : GraphQLObjectType ; subscription ? : GraphQLObjectType ; types ? : Array < GraphQLNamedType > ; directives ? : Array < GraphQLDirective > ; } ; skip export class GraphQLSchemaExt extends GraphQLSchema { constructor ( config ) { super ( config ) ; } public extend ( spec ) { const mergedSchema = extendSchema ( this , parse ( spec ) ) ; Object . assign ( this , mergedSchema ) ; } }