Say I have a typescript interface:
interface IPerson {
id: string,
name: string
}
And I run a table scan on a persons table in dynamo, what I want to be able to do is this:
const client = new AWS.DynamoDB.DocumentClient();
client.scan(params, (error, result) => {
const people: IPerson[] = result.Items as IPerson[];
};
I am getting the error Type 'AttributeMap[]' cannot be converted to type 'IPerson[]'
Obviously they are different types, however the data structure is exactly the same. My question is how can I essentially cast the dynamo AttributeMap to my IPerson interface?