我是graphql.js的新手,我正在尝试构建一个嵌套的graphql类型。
目前我有一个GameStatistic
类型,我想有一个Statistic
类型有两个字段与GameStatistic类型。
const gameStatisticType = new GraphQLObjectType({
name: 'GameStatistic',
fields: {
id: { type: GraphQLString },
wagered: { type: GraphQLFloat },
profit: { type: GraphQLFloat },
},
});
exports.Type = new GraphQLObjectType({
name: 'Statistic',
fields: {
dice: new GraphQLObjectType(gameStatisticType),
wheel: new GraphQLObjectType(gameStatisticType),
},
});
但它一直给出"The type of Statistic.wheel must be Output Type but got: undefined."
和"The type of Statistic.dice must be Output Type but got: undefined."
的误差
我到底做错了什么?
1条答案
按热度按时间qzwqbdag1#
GraphQLObjectType
,您已经有一个示例.type
属性中