deno-slack-api
deno-slack-api copied to clipboard
Potential typing issue with datastore API
Need to reproduce as a first step!
But, as reported in a feedback session by a community developer, with the following datastore:
export const OldestCodeReviewDatastore = DefineDatastore({
name: 'code_review_datastore',
attributes: {
id: {
type: Schema.types.string
},
timestamp: {
type: Schema.types.string
}
},
primary_key: 'id'
})
This code apparently returns an any type.
async function getOldestReview(client: SlackAPIClient, channel: string) {
const oldestReview = await client.apps.datastore.get<typeof OldestCodeReviewDatastore.definition>({
datastore: 'code_review_datastore',
id: 'oldest_review_' + channel
})
if (!oldestReview.ok) {
console.log('Error during request apps.datastore.get!', oldestReview)
return '0'
}
return oldestReview?.item?.timestamp ?? '0'
}
This does seems correct our typeahead for datastores is not as capable as the one found for input parameters in functions
Where with input functions we properly predict the type