![](/img/trans.png)
[英]Fastify with TypeScript, How to validate and type a routes request?
[英]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.