types 3.0: breaking change for event payloads

Open
#1,904 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
typescript

Research direction

Start by reviewing the current MessageEvent definitions in the @slack/types package and the linked Bolt and node-slack-sdk issues. Compare how these types are used in Bolt and elsewhere, then document the developer pain points and agree on the breaking-change scope for the 3.0 release.

Written by the indexing model from the issue text.

Description

area:typescript enhancement pkg:types semver:major

This would be a follow-up issue to tackle once slackapi/bolt-js#1395 is addressed; slackapi/bolt-js#1395 simply adds the existing, likely lacking, types for Events API payloads to the types package. This issue would be about breaking those payloads and include that in a new 3.0 release of @slack/types.

Summary

Improvements to MessageEvent

Today, MessageEvent is a big union of different events Slack may send to apps, presumably that include some message information. Because it is a union, when using it as a type both in applications as well as frameworks (like bolt), only the common properties across all types in this union can be used. Some properties that would be expected to be present on messages are not common in this union today: text and blocks, for instance. We should study how this type is used in bolt and elsewhere, and consider a different approach to modeling message events. For example, perhaps a generics-based approach could better serve?

Another problem when working with MessageEvent in TypeScript is the fact that one member of the union, the GenericMessageEvent, has subtype: undefined. This causes major problems when trying to match against the union of all different kinds of messages, since many message subtype events have a defined string literal subtype. subtype: undefined needs to get the 🔪 .

TODO

Review Issues to Identify Pain Points

The following should be studied to determine the scope of what these breaking changes should include, in order to address developer pain points, and folded into the Summary section above in order to plan the changes:

Dominant language
TypeScript
Stars
3.4k
Forks
693
Avg merge
1d 1h
Merged PRs (30d)
67

Getting set up

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.

More from slackapi/node-slack-sdk

All issues in slackapi/node-slack-sdk

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.