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

fix(toast, action-sheet): button handler can return Promise<void> #21259

Merged
merged 2 commits into from
May 26, 2020
Merged

fix(toast, action-sheet): button handler can return Promise<void> #21259

merged 2 commits into from
May 26, 2020

Conversation

simonhaenisch
Copy link
Contributor

@simonhaenisch simonhaenisch commented May 10, 2020

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

A toast button can't take an async function that returns Promise<void> as its handler.

Type '() => Promise<void>' is not assignable to type '() => boolean | void | Promise<boolean>'.
  Type 'Promise<void>' is not assignable to type 'boolean | void | Promise<boolean>'.
    Type 'Promise<void>' is not assignable to type 'Promise<boolean>'.
      Type 'void' is not assignable to type 'boolean'. ts(2322)

Issue Number: N/A

What is the new behavior?

  • A toast button can take an async function that returns Promise<void> as its handler.

Does this introduce a breaking change?

  • Yes
  • No

Other information

There might be other button interfaces with this issue...

Update: fixed the same thing for the action sheet (after checking all similar interfaces).

@ionitron-bot ionitron-bot bot added the package: core @ionic/core package label May 10, 2020
@simonhaenisch simonhaenisch changed the title fix(toast): handler of ToastButton can return Promise<void> fix(toast, action-sheet): button handler can return Promise<void> May 10, 2020
@simonhaenisch
Copy link
Contributor Author

@liamdebeasi would you mind having a look at this, please?

@brandyscarney brandyscarney merged commit 7703da2 into ionic-team:master May 26, 2020
@brandyscarney
Copy link
Member

Thanks! 🙂

@simonhaenisch simonhaenisch deleted the patch-1 branch May 26, 2020 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants