在此示例中 https://graphql.org/graphql-js/constructing-types/
我们有可能实现Type引用其根吗?父母类型? (经理字段类型引用回userType)
var userType = new graphql.GraphQLObjectType({
name: 'User',
fields: {
id: { type: graphql.GraphQLString },
name: { type: graphql.GraphQLString },
manager: { type: userType },
}
});
答案 0 :(得分:1)
Thunk解决了我的问题,返回了字段。
var userType = new graphql.GraphQLObjectType({
name: 'User',
fields: ()=> {
return {
id: { type: graphql.GraphQLString },
name: { type: graphql.GraphQLString },
manager: { type: userType }
}
}
});