Angular RxJS:自定义点状-Observable <{}>和Observable <void>

时间:2019-05-09 10:20:05

标签: angular typescript rxjs

类型'UnaryFunction,Observable>'的参数不能分配给'类型UnaryFunction,Observable>'的参数。

我正在尝试解决此编译错误:

const defaultQuery = () => map(() => <pojo.Query>{
    filter: this.cercacodi,
    offset: 0,
    limit: SearchComponent.DEFAULT_PAGE_SIZE
});

// Grab search button click event
this.searchQuery$ = this.$searchClick.pipe(defaultQuery());  //<Compilation error here>

其中:

private $searchClick: Observable<void>;
private searchQuery$: Observable<pojo.Query>;

编译错误为:

Argument of type 'UnaryFunction<Observable<{}>, Observable<Query>>' is not assignable to parameter of type 'UnaryFunction<Observable<void>, Observable<Query>>'.
  Type 'Observable<{}>' is not assignable to type 'Observable<void>'.
    Type '{}' is not assignable to type 'void'.

0 个答案:

没有答案