我在angular7得到了服务,这给了我一些钥匙:
getList(
pageSize: number = 30,
pageNumber: number = 0,
filters: CKeyListFilters = <CKeyListFilters>{},
sortByKey: string = 'activeTo',
sortOrder: SortOrder = SortOrder.DESC
): Observable<ListPaginated<CKey[]>> {
// ....
return this.http
.get<ListPaginated<CKey[]>>(`${environment.CApiUrl}/Get`, {
params: params,
observe: 'response',
})
.pipe(
map((resp: HttpResponse<CKey[]>) => {
return {
content: resp.body,
pagination: this.utilities.getPaginationMetaData(resp),
} as ListPaginated<CKey[]>;
}),
catchError((error) => {
throw error;
})
);
}
但在
pipe
方法我得到此错误:
error TS2345: Argument of type 'OperatorFunction<HttpResponse<CKey[]>, ListPaginated<CKey[]>>' is not assignable to parameter of type 'OperatorFunction<HttpResponse<ListPaginated<CKey[]>>, ListPaginated<CKey[]>>'.
所以我想绘制
HttpResponse<CKey[]>
到
ListPaginated<CKey[]>
但我不知道如何才能改变它。
我继承了这个代码,我是
typescript
,所以任何建议都对我有用!