Skip to content
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

types 3.0: breaking change for event payloads #1904

Open
filmaj opened this issue Aug 29, 2024 · 0 comments
Open

types 3.0: breaking change for event payloads #1904

filmaj opened this issue Aug 29, 2024 · 0 comments
Assignees
Labels
area:typescript issues that specifically impact using the package from typescript projects enhancement M-T: A feature request for new functionality pkg:types applies to `@slack/types` semver:major

Comments

@filmaj
Copy link
Contributor

filmaj commented Aug 29, 2024

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:

@filmaj filmaj added semver:major enhancement M-T: A feature request for new functionality area:typescript issues that specifically impact using the package from typescript projects pkg:types applies to `@slack/types` labels Aug 29, 2024
@filmaj filmaj added this to the [email protected] milestone Aug 29, 2024
@filmaj filmaj self-assigned this Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typescript issues that specifically impact using the package from typescript projects enhancement M-T: A feature request for new functionality pkg:types applies to `@slack/types` semver:major
Projects
None yet
Development

No branches or pull requests

1 participant