为什么 (Observable<T>) => Observable<R> 解析为 OperatorFunction<T, R>

Why does (Observable<T>) => Observable<R> resolve as OperatorFunction<T, R>

来自 ng-bootstrap documentation 的示例代码:

查看示例“Wikipedia 搜索”,单击“ 代码”并选择文件“typeahead-http.ts”。

  search: OperatorFunction<string, readonly string[]> = (text$: Observable<string>) =>
    text$.pipe(
      debounceTime(300),
      distinctUntilChanged(),
      tap(() => this.searching = true),
      switchMap(term =>
        this._service.search(term).pipe(
          tap(() => this.searchFailed = false),
          catchError(() => {
            this.searchFailed = true;
            return of([]);
          }))
      ),
      tap(() => this.searching = false)
    )

以及RxJS documentationOperatorFunction的定义:

interface OperatorFunction<T, R> extends UnaryFunction, Observable> {

  // inherited from index/UnaryFunction
  (source: T): R
}

为什么search的类型可以声明为:

根据定义是:

但随后赋值给带签名的箭头函数

尝试将 Observable<T> 分配给 T 不应该有冲突吗?我在这里错过了什么?箭头函数 search 的实际结果 return 类型是什么?

文档页面未打开 <

所以OperatorFunction定义为(https://github.com/ReactiveX/rxjs/blob/7.1.0/src/internal/types.ts#L23):

export interface OperatorFunction<T, R> extends UnaryFunction<Observable<T>, Observable<R>> {}

然后 UnaryFunction 声明为 (https://github.com/ReactiveX/rxjs/blob/7.1.0/src/internal/types.ts#L19-L21):

export interface UnaryFunction<T, R> {
  (source: T): R;
}

这意味着 search 声明为:

(source: Observable<string>): Observable<string[]>;