I am trying to add an AlertController to my Ionic 6 app with the below code:
presentAlert() {
let alert = this.alertCtrl.create({
title: 'Low battery',
subTitle: '10% of battery remaining',
buttons: ['Dismiss']
});
alert.present();
}
However, my IDE is throwing this error message under title: 'Low battery'
:
Argument of type ‘{ title: string; subTitle: string; buttons: {}; }’ is not assignable to parameter of type ‘AlertOptions’.
Object literal may only specify known properties, and ‘title’ does not exist in type ‘AlertOptions’.
I am copying this code from the ionic documentation, so I don’t know why it’s throwing an error. Can someone please tell me why this is, & how it can be resolved?