我试图为我的graphql 'route'写一个测试,我遇到了一些错误。这个路由在graphql playground中运行得很好,但在我的测试中,我得到了错误Type 'DocumentNode' is not assignable to type 'string | DocumentNode | undefined'.
。
我的测试看起来像这样:
错误是这样的:
我试图为我的graphql 'route'写一个测试,我遇到了一些错误。这个路由在graphql playground中运行得很好,但在我的测试中,我得到了错误Type 'DocumentNode' is not assignable to type 'string | DocumentNode | undefined'.
。
我的测试看起来像这样:
错误是这样的:
2条答案
按热度按时间w1e3prcc1#
对于在这里结束的其他人,当我忘记将
gql
添加到查询中时,我得到了错误Type 'string' is not assignable to type 'DocumentNode | TypedDocumentNode<unknown, { arguments: { id: string; }; }> apollo
是的
6ljaweal2#
尝试从导入graphQL客户端的同一个包中导入gql,这样当涉及到gql/nodeDocument时,它们就可以完全匹配类型。