const observable$ = combineLatest([searchAPI$, searchByID$]) // Line 1
.pipe(
map(data => {
let APISearchResult = data[0]; // This is an array of SearchResult type
const searchByIDRawData = data[1]; // This is an array of Opportunity type
// Create an array of Observable of Search Result for each of the Opportunity type
const searchByIDSearchResults$ = searchByIDRawData.map(s => this.CreateSearchResultItemFromOpportunity(s, keywordSearch)); // Line 7
return combineLatest(searchByIDSearchResults$)
.pipe(
map(searchResults => {
return APISearchResult.concat(searchResults); // Combine the output from APISearchResult with searchByIDSearchResults$
})
)
}))
return observable$;
I have a situation where two Observables are combined in Line 1 to produce the final output.
Line 7 involves emitting an array of Observables that convert the output from Opportunity
type to SearchResult
type when subscribed.
The intended final result should be an array of SearchResult[]
.
Unfortunately, the current type of observable$
is
Observable<Observable<SearchResult[]>>
, which is not what was expected.
Can someone point out where there might be an issue in the mapping process?
Thank you.