Ionic-framework: Compilation error when passing a callback to onDidDismiss / onWillDismiss methods of overlay based components

Created on 30 Aug 2018  路  5Comments  路  Source: ionic-team/ionic-framework

Bug Report

Ionic Info
Run ionic info from a terminal/cmd prompt and paste the output below.

Ionic:

   ionic (Ionic CLI)          : 4.1.0 (/Users/max/.nvm/versions/node/v8.9.3/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.6
   @angular-devkit/core       : 0.7.3
   @angular-devkit/schematics : 0.7.3
   @angular/cli               : 6.1.3
   @ionic/ng-toolkit          : 1.0.7
   @ionic/schematics-angular  : 1.0.5

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : none
   Cordova Plugins       : no whitelisted plugins (0 plugins total)

System:

   Android SDK Tools : 26.1.1
   ios-deploy        : 1.9.2
   ios-sim           : 5.0.12
   NodeJS            : v8.9.3 (/Users/max/.nvm/versions/node/v8.9.3/bin/node)
   npm               : 6.4.0
   OS                : macOS High Sierra
   Xcode             : Xcode 9.4.1 Build version 9F2000

Environment:

   ANDROID_HOME : /Users/max/Library/Android/sdk

Describe the Bug
After update to 4.0.0-beta.6 code that uses overlay based components such as Modals and Alerts does not compile when a callback is passed to onDidDismiss or onWillDismiss methods.

The following error is displayed:
error TS2554: Expected 0 arguments, but got 1.

triage

Most helpful comment

I also had this issue, solved it by using:

Change
.onDidDismiss((data) => {
to
.onDidDismiss().then((data) => {

The documentation lacks some information about this, but I can understand because its still in beta ;)

All 5 comments

I also had this issue, solved it by using:

Change
.onDidDismiss((data) => {
to
.onDidDismiss().then((data) => {

The documentation lacks some information about this, but I can understand because its still in beta ;)

@bashoogzaad, thank you very much. I totally forgot they changed it to return Promises. Unfortunately, autocompletion in WebStorm doesn't work for Ion*Elements (https://github.com/ionic-team/ionic/issues/14784).

I understand, I have the same kind of 'struggles' in VSCode 馃槅

Just got it.

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings