中继:片段无法以未知类型“查看器”为条件

时间:2019-12-22 19:32:48

标签: reactjs graphql relayjs

我正在尝试编译我的Relay应用程序,但是在尝试编译时出现错误:

yarn run relay-compiler --src ./src --schema ./src/schema.graphql --extensions=js --extensions=jsx

投掷:

Writing js
ERROR:
Fragment "ListPage_viewer" cannot condition on unknown type "Viewer".
error Command failed with exit code 100.

我试图编译的组件如下:

import React from 'react'
import {
    createFragmentContainer,
    graphql
} from 'react-relay'

const ListPage = ({
    viewer
}) => (
    <div>
        {JSON.stringify({viewer})}
    </div>
)

export default createFragmentContainer(ListPage, graphql`
    fragment ListPage_viewer on Viewer {
        posts(last:100) @connection(key: "ListPage_posts", filters: []){
            edges {
                node {
                    ...Post_post
                }
            }
        }
    }
`)

信息 我使用的一些依赖项是:

"babel-plugin-relay": "^8.0.0",
"relay-compiler": "^8.0.0"
"react-relay": "^8.0.0",

0 个答案:

没有答案