'Observable<xyz[]>' 类型的参数不可分配给 'OperatorFunction<unknown, unknown>' 类型的参数

Argument of type 'Observable<xyz[]>' is not assignable to parameter of type 'OperatorFunction<unknown, unknown>'

引发错误 Argument of type 'Observable<HistoryBranch[]>' is not assignable to parameter of type 'OperatorFunction<unknown, unknown>'.
// private historyBranches$: Observable<historyBranches[]>;

this.historyBranches$ =  this.timeline$.pipe(
            switchMap((tmln) => this.getHistoryBranches$(tmln)));

this.getHistoryBranches 实现为:

    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));
    }

这是什么OperatorFunction? (文档对我来说并没有真正阐明太多.. https://rxjs.dev/api/index/interface/OperatorFunction) 为什么类型不匹配?

问题可能与 getHistoryBranches 方法的 returned 值有关

仔细检查它的 return 类型,并确保 response 的值符合您的预期。这看起来有点不对劲,但您需要 post 为服务功能编写代码以确保