Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ack(options) does not compile in TypeScript #720

Closed
foch01 opened this issue Dec 27, 2020 · 3 comments · Fixed by #878
Closed

ack(options) does not compile in TypeScript #720

foch01 opened this issue Dec 27, 2020 · 3 comments · Fixed by #878
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented good first issue Good for newcomers TypeScript-specific
Milestone

Comments

@foch01
Copy link

foch01 commented Dec 27, 2020

Description

Why do I have this error?
Do you have a solution to specify the right type?

I want to send options in a select menu in modal

Attachments:

image

@gitwave gitwave bot added the untriaged label Dec 27, 2020
@seratch seratch added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented question M-T: User needs support to use the project TypeScript-specific and removed untriaged labels Dec 27, 2020
@seratch
Copy link
Member

seratch commented Dec 27, 2020

Hello @foch01 - I just checked this and it seems this framework's TS type resolution in this scenario does not work well. A workaround at this time is to have a type parameter <"block_suggestion"> in the app.options like this:

const options: Option[] = [
  {
    "text": {
      "type": "plain_text",
      "text": "foo"
    },
    "value": "bar"
  }
];

app.options<"block_suggestion">("test", async ({ ack}) =>{
  await ack({options: options})
});

app.options("test", async ({ ack}) =>{
  // Argument of type '{ options: Option[]; }' is not assignable to parameter of type '(Without<BlockOptions, OptionGroups<BlockOptions>> & OptionGroups<BlockOptions> & Without<...> & OptionGroups<...> & Without<...> & OptionGroups<...>) | (Without<...> & ... 4 more ... & DialogOptions) | undefined'.
  await ack({options: options})
});

Thanks a lot for reporting this issue.

@seratch seratch changed the title Set Options Ack() external data in Modal ack(options) does not compile in TypeScript Dec 27, 2020
@foch01
Copy link
Author

foch01 commented Dec 28, 2020

OK, thanks. It worked for me.

Keep me posted on the fix for this bug 😄

@seratch seratch added good first issue Good for newcomers and removed question M-T: User needs support to use the project labels Feb 19, 2021
@seratch
Copy link
Member

seratch commented Mar 23, 2021

Considering the majority of users, we can make the block_suggestion type as the default. I will check it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented good first issue Good for newcomers TypeScript-specific
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants