【问题标题】:Use mercurius, fastify with typegraphql make an error使用 mercurius,使用 typegraphql 进行 fastify 会出错
【发布时间】:2022-01-02 00:54:53
【问题描述】:

我正在尝试将 typegraphql 与 mercurius 和 fastify 结合使用

当我删除它时,错误消失了

这是显示的错误消息:

没有重载匹配这个调用。 Overload 1 of 3, '(plugin: FastifyPluginCallback, opts?: FastifyRegisterOptions | undefined): FastifyInstance<...> & PromiseLike<...>',给出了以下错误。 类型 'GraphQLSchema' 不可分配给类型 'string |字符串[] | GraphQLSchema |不明确的'。 “GraphQLSchema”类型缺少“GraphQLSchema”类型的以下属性:描述、getImplementations、isSubType Overload 2 of 3, '(plugin: FastifyPluginAsync, opts?: FastifyRegisterOptions | undefined): FastifyInstance<...> & PromiseLike<...>',给出了以下错误。 “typeof mercurius”类型的参数不可分配给“FastifyPluginAsync”类型的参数。 类型 'void' 不能分配给类型 'Promise'。 重载 3 of 3, '(插件:FastifyPluginCallback | FastifyPluginAsync | Promise<...> | Promise<...>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>',给出以下错误。 类型 'GraphQLSchema' 不可分配给类型 'string |字符串[] | GraphQLSchema |未定义'。

【问题讨论】:

  • 这似乎是一个冲突问题。你安装了什么模块版本?

标签: node.js typescript graphql fastify typegraphql


【解决方案1】:

我不得不将 graphql 软件包从版本 6 降级到 4,因为 mercurius 直到现在才支持 graphql 6。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-04
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    相关资源
    最近更新 更多