-
Notifications
You must be signed in to change notification settings - Fork 426
The ack property type of SlackOptionsMiddlewareArgs is incorrect #922
Copy link
Copy link
Closed
Labels
TypeScript-specificbugM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documentedM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documentedsemver:minor
Milestone
Description
Description
When using the options example here, TypeScript gives the following error when using ack:
TS2345: Argument of type '{ options: Option[]; }' is not assignable to parameter of type '(Without<MessageOptions, OptionGroups<MessageOptions>> & OptionGroups<MessageOptions> & Without<...> & OptionGroups<...> & Without<...> & OptionGroups<...>) | (Without<...> & ... 4 more ... & BlockOptions) | undefined'.
Types of property 'options' are incompatible.
Type 'Option[]' is not assignable to type '{ text: string; value: string; }[] & { label: string; value: string; }[] & Option[]'.
Type 'Option[]' is not assignable to type '{ text: string; value: string; }[]'.
Type 'Option' is not assignable to type '{ text: string; value: string; }'.
Types of property 'text' are incompatible.
Type 'PlainTextElement | MrkdwnElement' is not assignable to type 'string'.
Type 'PlainTextElement' is not assignable to type 'string'.
This is fixed by the following cast, which shouldn't be necessary, but is:
ack as AckFn<{ options: Option[] }>I believe this has to do with the XOR in AckFn<XOR<BlockOptions, OptionGroups<BlockOptions>>>
What type of issue is this? (place an x in one of the [ ])
- bug
- enhancement (feature request)
- question
- documentation related
- example code related
- testing related
- discussion
Requirements (place an x in each of the [ ])
- 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.
Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
package version: 3.3.0
node version: N/A
OS version(s): N/A
Steps to reproduce:
- Implement the given Bolt example for Options, in TypeScript
- Receive a TS error
Expected result:
What you expected to happen
Actual result:
What actually happened
Attachments:
Logs, screenshots, screencast, sample project, funny gif, etc.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
TypeScript-specificbugM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documentedM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documentedsemver:minor