You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ionic4/angular: overlay getTop can return undefined #17801
Current behavior:
In the angular package, the return type of the getTop method in OverlayBaseController is Promise<Overlay>
Expected behavior:
The return type should be Promise<Overlay | undefined>
Steps to reproduce:
Use any component extending OverlayBaseController and call the getTop method without any alert currently present. With the AlertController for example, returned object will be of type Promise<HTMLIonAlertElement>, while it should be Promise<HTMLIonAlertElement | undefined>.
Related code:
import{Component,OnInit}from'@angular/core';import{AlertController}from'@ionic/angular';
@Component({selector: 'app-home',templateUrl: 'home.page.html',styleUrls: ['home.page.scss'],})exportclassHomePageimplementsOnInit{constructor(privatealertController: AlertController){}asyncngOnInit(){constundefinedAlert=awaitthis.alertController.getTop();// typed as HTMLIonAlertElementalert(`type of alert is ${typeofundefinedAlert}`);// typeof undefinedAlert === 'undefined'undefinedAlert.dismiss();// still possible because of the typing, will throw an error}}
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.
Activity
Pierrci commentedon Mar 15, 2019
Just submitted the related PR
brandyscarney commentedon Jun 5, 2019
It seems the PR was merged so I'm going to close this, thanks for the issue!
ionitron-bot commentedon Jul 5, 2019
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.