-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
socket-mode: Type event payloads #1768
Comments
This boilerplate creates some basic AprilBot functionality for connecting to slack and handling some basic types of interactions. I had to create types for the event handlers for now, though I opened an issue in the Slack sdk in the hopes they might add types [1] to their events. This also swaps out the class-methods-use-this lint rule for a smarter variety, which is probably something that the upstream maintainer should consider adding as well [2]. [1] slackapi/node-slack-sdk#1768 [2] iamturns/eslint-config-airbnb-typescript#344
I agree this would be a fantastic enhancement. The issue is that perfect typing for Slack payload events is challenging, as the payloads can be quite contextual. For example, depending on the Slack workspace type (enterprise vs. standalone), the payloads might differ. Additionally, some payloads may or may not contain properties depending on the context, for example That said, at least some baseline form of event typing should be doable. I will leave this as an enhancement issue open but can make no promises on a delivery timeline. |
I'm using
@slack/socket-mode
in a TypeScript project and would love to be able to benefit from type definitions when defining event handlers -- e.g. when I invoke something along the lines ofI'd like
event
to not be of theany
type but instead to reflect the expected type for the event in question.It looks like there are libraries that might support this, for your consideration.
Packages:
Select all that apply:
@slack/web-api
@slack/rtm-api
@slack/webhooks
@slack/oauth
@slack/socket-mode
@slack/types
Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
The text was updated successfully, but these errors were encountered: