Skip to content

MessageEvent type definition does not match event data when subtype is 'message_changed' #311

@ieaalto

Description

@ieaalto

Description

Concerning TypeScript, there seems to be a mismatch between message event type definitions and the actual events from Slack. For instance the following example would cause unexpected errors due to message_changed events:

app.message(({ message }) => {
  const user: string = message.user
  if (user.match(/^U/)) {
    // ...
  }
})

The type definition does not allow message.user to be undefined, but in reality it may be when the subtype is message_changed. This issue is easy to work around by filtering by subtype, but these type safety breaking issues can be fiendishly difficult to detect.

What type of issue is this?

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Metadata

Metadata

Assignees

Labels

TypeScript-specificbugM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions