繁体   English   中英

在Typescript中fastify路由请求和响应处理程序类型

[英]fastify route request and response handler type in Typescript

有人知道 fastify 中的请求和响应处理程序类型是什么吗?

现在我只是使用“任何”,打字稿 eslint 给了我一个警告:

fastify.post('/ac', async(req: any , res: any) => {

您正在寻找的适当类型分别是“FastifyRequest”和“FastifyReply”。

它们可以被导入和实现,如下所示。

import { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';

fastify.post('/ac', async (req: FastifyRequest, res: FastifyReply) => {

});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM