0
votes

const graphql = require('graphql');

const _ = require('lodash');

const { GraphQLObjectType, GraphQLString, GraphQlInt, GraphQlSchema } = graphql;

const userType = new GraphQLObjectType({

name: 'User',
fields: {   
    id: { type: GraphQLString },
    firstName: { type: GraphQLString },
    age: { type: GraphQlInt }
},

});

const users = [

{id: '1', firstName: 'Bill', age: 20},
{id: '47', firstName: 'Samantha', age: 21}

]

const RootQuery = new GraphQLObjectType({

name: 'RootQueryType',

fields: {
    user: {
        type: userType,
        args: { id: {type: GraphQLString}},
        resolve(args: any){
           return _.find(users, {id: args.id});
        }
    }
}

});

module.exports = new GraphQlSchema({

query: RootQuery

});

module.exports = new GraphQlSchema({ ^ TypeError: GraphQlSchema is not a constructor

I'm confused by the error TypeError: GraphQlSchema is not a constructor