作者:目目目目目目目目目目目目 | 来源:互联网 | 2023-01-29 20:18
说我有一个打字稿界面:
interface IPerson {
id: string,
name: string
}
我在发电机上的人员表上运行表扫描,我想做的是:
const client = new AWS.DynamoDB.DocumentClient();
client.scan(params, (error, result) => {
const people: IPerson[] = result.Items as IPerson[];
};
我收到错误 Type 'AttributeMap[]' cannot be converted to type 'IPerson[]'
显然,它们是不同的类型,但是数据结构是完全相同的。我的问题是,从本质上讲AttributeMap
我如何才能将发电机投射到IPerson
界面上?