我已将我与该文件的连接分离出来并可以在我的根查询中使用它(当在类型中定义连接时它工作正常),但是当尝试通过将其导入到类型时使用它,连接是为了我回来:
错误:PageEdge.node字段类型必须是输出类型,但得到:undefined
我可以在QueryType中使用连接,但不能使用PageType.我的架构大致是这样的.
QueryType {
pages: [PageType]
}
PageType {
_id: string
pages: [PageType]
}
Run Code Online (Sandbox Code Playgroud)
这是一个项目仓库的链接,其中graphql的东西是(我只是推了一个提交,错误地看到所有的代码):https: //github.com/DaveyEdwards/myiworlds/tree/master/src/data
我已经使QueryType和PageType字段thunk(似乎解决了大多数人的问题的解决方案),并尝试从接口中创建一个thunk:
interfaces: () => [nodeInterface]
Run Code Online (Sandbox Code Playgroud)
对于任何与用户和朋友构建应用程序的人来说,我认为这是一个非常常见的问题.
UserType: {
friends: [UserType]
}
Run Code Online (Sandbox Code Playgroud)
我的PageType:
import { nodeInterface } from '../nodeInterface';
import PageConnection from './connections/PageConnection';
const PageType = new ObjectType({
name: 'Page',
description: 'Everything you see can be placed inside a page.',
fields: () => ({
id: globalIdField('Page', page => page._id),
_id: {
type: new NonNull(ID),
description: 'A unique id used to instantly locate …Run Code Online (Sandbox Code Playgroud)