I'm creating a function with returns a Promise, but may have some promise in cascade:
mainFunction(): Promise<boolean> {
return this.function1().then(
(data) => {
if(data.condition1()){
this.function2()
.then(() => {
return true // here my problem
})
} else if (data.condition2()){
return true;
} else {
return false;
}
}
);
}
function1: Promise<string>{
//return promise<string>
}
function2: Promise<any>{
//return promise<any>
}
mainFunction works fine in "else if" and "else", where no Promise are in cascade but in "if" where I ask for promise after another promise true is not returned.
How can I do this?