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

Why is `WebAPICallOptions` not type-safe?

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

Description

I recently encountered a bug that was due to using a non-existent property in ChatPostMessageArguments, which I assumed would not have been possible as it is a TypeScript interface. But such interface extends WebAPICallOptions, which allows any arbitrary key value pair, effectively removing its static type checking.

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

  • [ ] bug
  • [ ] enhancement (feature request)
  • [x] 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.

rr-codes avatar May 10 '21 16:05 rr-codes

Hi @rr-codes, this is a good question! My understanding is that the arbitrary keys were added for pagination support. Ideally, we would change it, but we must find a way to safely remove it from pagination. If we did, it would be a breaking change and need to be released in our next major version bump.

@kaz Since you're focused heavily on TS support right now, do you want to discuss this change more and possibly turn this into a task for the next major?

mwbrooks avatar May 11 '21 04:05 mwbrooks

As an additional note,

If we did, it would be a breaking change and need to be released in our next major version bump.

if we decided to do this, we may want to apply the similar to WebAPICallResult.

seratch avatar May 11 '21 08:05 seratch

Closing this as a duplicate of #1323

filmaj avatar Oct 04 '23 16:10 filmaj