在使用 AWS JavaScript SDK v3 时,可能会遇到以下类型错误的问题:
Type 'HttpResponse' is not generic. Did you mean to specify 'HttpResponse'?
解决方法是需要升级 TypeScript 版本并安装适配的 @aws-sdk/types 包。过程如下:
npm install --save-dev @aws-sdk/types
import { HttpResponse } from "@aws-sdk/types";
const response: HttpResponse = await client.send(command);
这样就能解决 TypeScript 报错问题了。