Method
hola() {
return new Promise((resolve, reject) => {
if(true) {
resolve(true)
}
})
}
Calling the method
this.hola.then(data => console.log(data));
Error
Property 'then' does not exist on type '() => Promise<{}>'.
I already tried to restart ionic serve but it keeps throwing that error
The parenthesis is missing while you are calling the method hola.
this.hola().then(data => console.log(data));
When you call the method, try this instead, storring it in a variable of type "any" makes it ignore the "existence" of the proprety
var a:any = this.slides.getActiveIndex()
a.then(data => {
console.log(data)
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With