From: https://medium.com/@ole.ersoy/synchronous-programming-with-rxjs-observable-6276721e674a
Scenario
We want to return a resolved value from our Observable.
Approach 1Turn the Observable into a Promise and await it like this:
async function returnTrue()
{
return await of(true).toPromise();
}
//logs true
returnTrue().then(console.log);The return value is now guaranteed to be available, as long as the observable did not error out.
Why do we need to turn an Observable to a Promise to get a resolved result? Observables are not capable on their own to get resolved results?
What's the point that I am missing here?