slackapi / slackapi/deno-slack-api
Potential typing issue with datastore API
Open
@filmaj is already working on this.
Since Jul 14, 2023.
question
- Dominant language
- TypeScript
- Stars
- 45
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
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'
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.