title: how can i get last value from a Observable?
body: <p>i try to get last value from a observable.
  the example code is</p>
  <pre class="lang-js prettyprint-override"><code>// RxJS v6+
  import { lastValueFrom, Subject } from 'rxjs';
  import { scan } from 'rxjs/operators';
  
  async function main() {
    const subject = new Subject();
  
    const example = subject.pipe(
      scan((acc, curr) =&gt; {
        return Object.assign({}, acc, curr);
      }, {}),
    );
    const subscribe = example.subscribe((val) =&gt;
      console.log('Accumulated object:', val),
    );
    subject.next({ name: 'Joe' });
    subject.next({ age: 30 });
    subject.next({ favoriteLanguage: 'JavaScript' });
  
    console.log('+++++++++++++');
    const resp = await lastValueFrom(example);
    console.log(resp);
    console.log('end');
  }
  
  main()
    .catch((e) =&gt; {
      console.error(e);
    })
    .finally(async () =&gt; {
      console.log('final');
    });
  
  </code></pre>
  <p>the output is</p>
  <pre class="lang-bash prettyprint-override"><code>➜  npns-service git:(mr/master/658) ✗ ts-node prisma/test.ts
  Accumulated object: { name: 'Joe' }
  Accumulated object: { name: 'Joe', age: 30 }
  Accumulated object: { name: 'Joe', age: 30, favoriteLanguage: 'JavaScript' }
  +++++++++++++
  </code></pre>
  <p>i can't got the resp output message.</p>
  <p>how can i got the resp value from example Observable?</p>