Edit: If text is never an observable:
const result$ = combineLatest(
summaryTitles.map(({ title, text }) =>
title.pipe(map(title => ({ title, text })));
)
);
A minimal reproducible example with something like stackblitz would be good, it's a pain to reproduce ngrx state and all, but something like this should work:
import { of, map, combineLatest } from 'rxjs';
const summaryTitles = [
{ title: of('1'), text: of('2') },
{ title: of('3'), text: of('4') }
];
const result$ = combineLatest(
summaryTitles.map(({title, text}) =>
combineLatest([title, text]).pipe(
map(([title, text]) => ({ title, text }))
)
)
);
result$.subscribe(console.log);
You may want to change combineLatest for forkJoin or zip. The doc's operator decision tree and learnrxjs.io are great for that.
Stackblitz: https://stackblitz.com/edit/rxjs-9gah4b?file=index.ts
Edit:
If the text field may be an observable or not, use isObservable, for example:
const result$ = combineLatest(
summaryTitles.map(({ title, text }) => {
const text$ = isObservable(text) ? text : of(text);
return combineLatest([title, text$]).pipe(
map(([title, text]) => ({ title, text }))
);
})
);
But it may be easier to insure it's an observable somewhere else before that.
Side note: I noticed now in my stackblitz the final result, which shouold be an array, is an "indexed object" ({ 0: 'foo', 1: 'bar' }). When I try to manually transform it to an array in ways that work in terminal it remains an object 🤷. I'm assuming this is a quirk in stackblitz. Check what you get live.