2

Working version:

   const observable = Observable
      .from([Promise.resolve('1'), Promise.resolve('2')])
      .subscribe((results) => {})

Broken version (added mergeAll operator):

const observable = Observable
  .from([Promise.resolve('1'), Promise.resolve('2')])
  .mergeAll()
  .subscribe((results) => {})

Propery 'subscribe' doesn't exist on type 'Promise<{string}>'

I'm using the basic Angular CLI setup.

What might be the reason?

1 Answer 1

1

Whenever you are returning the resolving the promise. You should be using fromPromise operator as below

const observable = Observable
  .fromPromise([Promise.resolve('1'), Promise.resolve('2')])
  .mergeAll()
  .subscribe(results => console.log(results));

Also try logging the results as in the code.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.