I have:
let resItem: Schema
resItem = await dynamoClient.get({
TableName,
Key: {
uuid: request.body.uuid
}
}).promise()
但我得到:
Type 'PromiseResult<GetItemOutput, AWSError>' is missing the following properties from type 'Schema': uuid, topics, phoneNumber, timezonets(2739)
如果你检查GetItemOutput 的定义 https://github.com/aws/aws-sdk-js/blob/e4d1a07e0d51e78fb268bcbebe23736416e4346a/clients/dynamodb.d.ts#L1326 and PromiseResult 的定义 https://github.com/aws/aws-sdk-js/blob/41c9d5a2ca0c455bea55c98bb99e647eed2c8781/lib/request.d.ts#L329你会看到承诺正在返回一个对象{Item, ConsumedCapacity, $response}
但不仅仅是结果。所以我认为你应该使用PromiseResult
作为类型并使用Item
属性作为你的结果。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)