slackapi / slackapi/node-slack-sdk

socket-mode: Type event payloads

Open
#1,768 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:typescript auto-triage-skip enhancement pkg:socket-mode semver:major
Dominant language
TypeScript
Stars
3.4k
Forks
688
Avg merge
15h 31m
Merged PRs (30d)
27

Description

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 of

socketModeClient.on(
  'reaction_added',
  async (event) => {
    ...
  }
);

I'd like event to not be of the any 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
  • I don't know
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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the @slack/socket-mode event-handler API and inspect how TypeScript declarations currently type callbacks. Consider the linked typed-emitter library, then verify that a reaction_added handler receives its expected event payload rather than any.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.