web-api: type-safe response properties access
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- api
Research direction
Reproduce the TypeScript example from the report using @slack/bolt 3.12.2, then trace the response type for app.client.users.info and its user property. Done means a successful response can expose its properties without an unnecessary undefined check, with coverage for the reported access pattern.
Written by the indexing model from the issue text.
Description
What type of issue is this? (place an x in one of the [ ])
- bug
Requirements (place an x in each of the [ ])
- I've read and understood the Contributing guidelines and have done my best effort to follow them.
- I've read and agree to the Code of Conduct.
- I've searched for any related issues and avoided creating a duplicate issue.
Bug Report
const slackUser = await app.client.users.info({
user: installation.user.id,
})
slackUser.user.name // Object `user` is possibly 'undefined'.
If there was an error here, the function would throw an error and we could catch it somewhere else. It's confusing me and should be a bug that we can't safely access properties after a function is called with no errors.
Should we be having to use if {} else {} to safely access these properties?
Reproducible in:
package version: "@slack/bolt": "^3.12.2",
- Dominant language
- TypeScript
- Stars
- 3.4k
- Forks
- 693
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 67
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from slackapi/node-slack-sdk
-
auto-triage-skip enhancement pkg:web-api
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
slackapi/node-slack-sdk#2607 · 2 comments · 2 reactions ·
Maintainers usually reply within 1 day
-
`SlackListsItem FieldMessage.message` type does not match API response shapePossibly taken @AjTheSpidey claimed this 202 days ago. Openarea:typescript auto-triage-skip bug pkg:web-api
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
slackapi/node-slack-sdk#2598 · 2 comments ·
Maintainers usually reply within 1 day
-
Missing TypeScript response type for files.uploadV2Possibly taken @Yshuro claimed this 6 days ago. Openarea:typescript auto-triage-skip bug pkg:web-api
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
slackapi/node-slack-sdk#2459 · 2 comments ·
Maintainers usually reply within 1 day
-
Docs/types: document `broadcast_delete` on chat.delete (undo reply_broadcast)Possibly taken A pull request linked to this issue is open or already merged. Openarea:typescript enhancement pkg:web-api semver:patch
Difficulty 5/5 Over a week Newbie friendliness 25/100
slackapi/node-slack-sdk#2815 · 1 comment ·
Maintainers usually reply within 1 day
-
auto-triage-stale
Difficulty 3/5 1-2 days Newbie friendliness 75/100
slackapi/node-slack-sdk#2791 · 1 comment ·
Maintainers usually reply within 1 day
All issues in slackapi/node-slack-sdk
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
agilepathway/label-checker#1015 · 2 comments ·
Maintainers usually reply within 1 day
-
tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug P3
Difficulty 1/5 Under an hour Newbie friendliness 89/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
react-component/image#541 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day