属性“查询”在类型“请求Nodejs和打字稿”上不存在

时间:2020-04-29 10:33:27

标签: node.js typescript

我正在尝试将打字稿添加到我现有的nodejs项目中。在我的控制器上,我导入express,如下所示:import { Request, Response, NextFunction } from "express",然后在我的代码中导入:

let reqQuery = { ...req.query };
// Typescript says that Property 'query' does not exist on type 'Request<any, any, any, any>'.ts(2339)

更新

这是完整的代码,getProducts是一个控制器(“ @ types / express”:“ ^ 4.17.6”)

import { Request, Response, NextFunction } from "express"
const getProducts = AsyncProvider( async 
(req: Request, res: Response, next: NextFunction) => {
    let reqQuery = { ...req.query };
    ....
})
...
module.exports = getProducts;

你能帮我吗?

谢谢

0 个答案:

没有答案