Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobiasmuehl/058708dac375cdde24e7f3bee6fcb6ce to your computer and use it in GitHub Desktop.
Save tobiasmuehl/058708dac375cdde24e7f3bee6fcb6ce to your computer and use it in GitHub Desktop.
Use new Arrow function syntax instead.
const Post = new GraphQLObjectType({
name: "Post",
description: "This represent a Post",
fields: () => ({
_id: {type: new GraphQLNonNull(GraphQLString)},
title: {
type: new GraphQLNonNull(GraphQLString),
resolve: post => (post.title || "Does not exist")
},
content: {type: GraphQLString}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment