我对TypeScrip非常陌生,所以可能我忽略了一些明显的东西,但我无法在不触发似乎完全是虚假的@Typescript-eslint警告的情况下使用AWS v3 Java脚本SDK.下面是一个小片段,它再现了一个不一致的地方:
import { S3Client } from "@aws-sdk/client-s3";
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
new S3Client({});
new DynamoDBClient({});
S3客户端构造很好.没有警告.
但是,构建DynamoDB客户端的最后一行的结果是ESLint: Unsafe construction of an any type value.(@typescript-eslint/no-unsafe-call)
这基本上直接从他们的"Hello DynamoDB"文档中脱颖而出.
这两个包都已安装,并且类型看起来基本相同,尽管我想可能在配置类型的细节中隐藏了一些微妙之处(为了清楚起见,稍微简化了一些):
export declare class S3Client extends __Client<__HttpHandlerOptions, ServiceInputTypes, ServiceOutputTypes, S3ClientResolvedConfig> {
readonly config: S3ClientResolvedConfig;
constructor(configuration: S3ClientConfig);
}
VS
export declare class DynamoDBClient extends __Client<__HttpHandlerOptions, ServiceInputTypes, ServiceOutputTypes, DynamoDBClientResolvedConfig> {
readonly config: DynamoDBClientResolvedConfig;
constructor(configuration: DynamoDBClientConfig);
}
它们看起来基本一样.如何将构造函数视为返回any
?这太奇怪了.
我的package.json
包含:
"dependencies": {
"@aws-sdk/client-dynamodb": "^3.351.0",
"@aws-sdk/client-s3": "^3.282.0",
...