The error Argument of type 'Observable<HistoryBranch[]>' is not assignable to parameter of type 'OperatorFunction<unknown, unknown>'.
is being thrown by
// private historyBranches$: Observable<historyBranches[]>;
this.historyBranches$ = this.timeline$.pipe(
switchMap((tmln) => this.getHistoryBranches$(tmln)));
this.getHistoryBranches
is implemented as:
private getHistoryBranches$(timelineData: Timeline[]): Observable<HistoryBranch[]> {
return this.service.getHistoryBranches({
startTime: timelineData[0].time,
endTime: timelineData[timelineData.length - 1].time,
}).pipe(map(response=>response.HistoryBranches));
}
What is this OperatorFunction
? (documentation didn't really clarify much for me.. https://rxjs.dev/api/index/interface/OperatorFunction)
Why is there a type mismatch?
CodePudding user response:
Issue is probably related to the returned value of the getHistoryBranches
method
Double check it's return type, and also that the value of response
is what you expect. That looks a bit off, but you'd need to post code for the service function tod someone to be sure