我想做一个条件“如果常量的长度大于0”。这是代码...
public async get_one(req:Request, res:Response): Promise<any>{
const { id } = req.params;
const games = await pool.query('SELECT * FROM game WHERE id = ?', [id]);
if (games.length > 0 ){
return res.json(games[0]);
}
res.status(404).json({text:'game doesn exists'});
}
*这是错误: “类型'Query'上不存在属性'length'。”
我该怎么办?*