node-slack-sdk icon indicating copy to clipboard operation
node-slack-sdk copied to clipboard

Incorrect type: `ActionsBlock['elements']` erroneously allows values of `Multi*Select` interfaces

Open rr-codes opened this issue 3 years ago • 1 comments

Description

The ActionsBlock interface has an elements property of type (Button | Overflow | ... | Action)[];. All Multi*Select interfaces extend the Action interface. Therefore, according to the types, it is a valid action element.

However, in actuality, MultiSelects are not supported as elements in action blocks, per this reference. This leads to an error at run time when making the API call, even though it passes at compile time.

What type of issue is this? (place an x in one of the [ ])

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

Requirements (place an x in each of the [ ])

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

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Packages:

Select all that apply:

  • [x] @slack/web-api
  • [ ] @slack/events-api
  • [ ] @slack/interactive-messages
  • [ ] @slack/rtm-api
  • [ ] @slack/webhooks
  • [ ] @slack/oauth
  • [ ] @slack/socket-mode
  • [ ] I don't know

Reproducible in:

package version:

node version:

OS version(s):

Steps to reproduce:

  1. Use a Multi*Select value as an element within the elements property of ActionsBlock
  2. See it passes at compile time, but fails at run time as Multi*Select blocks aren't supported as Actions

Expected result:

For a type error to raise at compile time

Actual result:

No error until the failed API call is made

Attachments:

Logs, screenshots, screencast, sample project, funny gif, etc.

rr-codes avatar Jul 31 '21 05:07 rr-codes

Hi @rr-codes, thanks (as always) for taking the time to flag this! We have not checked this in detail but at first glance, you are right. This can be improved in the future versions.

seratch avatar Aug 04 '21 05:08 seratch

This is no longer a bug - not sure when it was resolved, but our docs now show Multi-Select elements being supported in Action blocks, and I verified that the backend schema allows this, too. Closing.

filmaj avatar Sep 26 '23 14:09 filmaj