How to type DynamoDB GetCommand

Hi all! I have something like this:
const response = await ddbDocClient.send(new GetCommand(input));
const response = await ddbDocClient.send(new GetCommand(input));
The returned object is response.Item and it is exactly what I expect. The problem is, the actual response.Item is literally just Record<string, any> | undefined. Is type casting the only way here just for good dx?
1 Reply
Sturlen
Sturlen2y ago
casting could work but won't actually guarantee anything at runtime. use a validator like zod for that
Want results from more Discord servers?
Add your server