I have many graphql types in my application.
I use graphql-js to construct them.
// example
const TruckDriver: GraphQLObjectType = new GraphQLObjectType({
name: 'TruckDriver',
fields: () => ({
id: { type: GraphQLString },
}),
})
Then I import such types in my different queries and mutations to define type of returned values.
But my resolvers don't return objects, they return instances of classes where fields information are in nested property 'info'. For example above resolver will return
{
info: {
id: '123'
}
...
}
I wanted to add resolver in my types but I found that types don't have resolvers.
How can I easy implement logic of fields data parsing for my object types?