I've created this Observable
:
private accounts$: Observable<{type: string, alias: string}>;
I need to map an Array<Account>
to an stream of {type, alias}
object. Up to now, I've tried this:
this.accounts$ = this.store$
.select(fromRoot.getDBoxAccountEntities)
.flatMap(accounts => accounts.map(account => {type: 'dbox', alias: account.dboxAccount}))
...
However I'm getting compilation error messages.
Any ideas?
You are returning an object from your arrow function but the brackets suggest function body. You need ()
around your returned object:
.flatMap(accounts => accounts.map(account => ({type: 'dbox', alias: account.dboxAccount})))
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