Closed brendo-m closed 2 years ago
The problem with TableName is that developers don't usually hard code literal values. Can we still narrow in that case without the literal string value? They would have to cast:
type MyTableName<Prefix extends string = string> = `MyTable-${Prefix}`
const myTableName = process.env.MyTableName as MyTableName
Perhaps we should provide a type safe BatchGetItemEntry (whatever its name is) for the specific table. Then use that function like how we overrode commands.
const GetMyTableItem = TypeSafeGetItem<..>;)
client.batchGet({
Items: [GetMyTableItem(..)]
})
The problem with TableName is that developers don't usually hard code literal values. Can we still narrow in that case without the literal string value? They would have to cast:
Good point
Pushed a fix for the misplaced ProjectionExpression
, and the response needed to have ToAttributeMap<...>
This pull request is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label.
Closing this pull request as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen. If you wish to exclude this issue from being marked as stale, add the "backlog" label.
Basic implementation, seems to work. It doesn't quite fit with the spirit of the library though because you can call
batchGetItem
for multiple tables. Should we impose thatTypesafeDynamoDBv{2,3}
only operates on a single table? if so, parameterizing the table name would improve the typing of the response here.