【问题标题】:Graphql Yoga Express - no overload matches this callGraphql Yoga Express - 没有重载匹配此调用
【发布时间】:2022-09-25 20:38:01
【问题描述】:
import { createServer } from \'@graphql-yoga/node\';
import express from \'express\';

// create mesh
const { schema, getEnveloped } = await getBuiltMesh();

// create express server
const app = express();

// create yoga server
const server = createServer({
    schema: schema,
});

// add graphql endpoint
app.use(\'/graphql\', server);

没有重载匹配此调用。最后一个重载给出了以下 错误。 类型参数 \'YogaNodeServerInstance<{ req: IncomingMessage;资源:服务器响应; }, { req: IncomingMessage; }, {}>\' 不是 可分配给 \'Application\' 类型的参数。 键入 \'YogaNodeServer<{ req: IncomingMessage;资源:服务器响应; }, { req: IncomingMessage; }, {}> & ((要求: IncomingMessage, res: ServerResponse) => Promise<...>)\' 缺少 来自类型 \'Application\' 的以下属性:init, defaultConfiguration、engine、set 和 60 多个.ts(2769)

根据https://www.graphql-yoga.com/docs/integrations/integration-with-express 它应该可以工作。

请帮助我理解我对 Graphql Yoga 的问题和表达。

我想要的只是暴露我的瑜伽服务器。

    标签: express graphql mesh


    【解决方案1】:

    我和你遇到了同样的问题。我认为它已在@graphql-yoga/node 的最新版本中得到解决(对我来说是 2.13.13)。

    您可以通过以下方式将软件包版本更新为最新版本:

    纱线升级@graphql-yoga/node --latest

    或者

    npm i @graphql-yoga/node@latest

    如果您使用的是 npm

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-01
      • 1970-01-01
      • 2020-02-17
      • 2020-03-28
      • 2021-04-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多