I came across the following code in a GraphQL-related post. Why are there brackets outside of the curly brackets in the fields parameter and what does this mean?
var PersonType = new GraphQLObjectType({
name: 'Person',
fields: () => ({
name: { type: GraphQLString },
bestFriend: { type: PersonType },
})
});
The following are the function expressions / declarations that I am aware of:
Standard Named Functions
function sayHello() {
alert("hello!");
};
ES6 Anonymous Functions
() => {
alert("hello!");
};
Self Invoked Functions
(function sayHello() {
alert("hello!");
})();
Self Invoked ES6 Anonymous Functions
(() => {
alert("hello!");
})();
As far as I'm aware, the fields function does not fit any of the above.