-
Notifications
You must be signed in to change notification settings - Fork 675
Cannot access the user id in the "message_changed" event with TypeScript #2026
Copy link
Copy link
Open
Labels
area:typescriptissues that specifically impact using the package from typescript projectsissues that specifically impact using the package from typescript projectsbugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedenhancementM-T: A feature request for new functionalityM-T: A feature request for new functionalitypkg:typesapplies to `@slack/types`applies to `@slack/types`semver:major
Milestone
Metadata
Metadata
Assignees
Labels
area:typescriptissues that specifically impact using the package from typescript projectsissues that specifically impact using the package from typescript projectsbugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedenhancementM-T: A feature request for new functionalityM-T: A feature request for new functionalitypkg:typesapplies to `@slack/types`applies to `@slack/types`semver:major
Reproducible in:
The Slack SDK version
3.13.1
Node.js runtime version
v16.15.1
OS info
ProductName: macOS
ProductVersion: 12.6.5
BuildVersion: 21G531
Darwin Kernel Version 21.6.0: Thu Mar 9 20:08:59 PST 2023; root:xnu-8020.240.18.700.8~1/RELEASE_X86_64
Steps to reproduce:
The Slack docs say that there should be the
message.userkey in themessage_changedevent containing the Slack user id.The TypeScript interface for the
MessageChangedEventrefers to theMessageEventinterface in themessageand theprevious_messageproperties that make TypeScript assume that accessingevent.message.useris not allowed because not every subtype of themessageevent contains a user id.It seems like the reference to the
MessageEventis incorrect because (I suppose) not every message can be edited and moreover it makes the circular dependency in types when themessage_changedevent can reference to themessage_changedevent and so on.Expected result:
messageproperty of themessage_changedevent has the valid type according to the Slack docsevent.message.userfor themessage_changedevent.Actual result: