我正在尝试将打字稿添加到我现有的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;
你能帮我吗?
谢谢