I got a service in angular7 what gives me back some keys:
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;
})
);
}
But inside the pipe method I got this error:
error TS2345: Argument of type 'OperatorFunction<HttpResponse<CKey[]>, ListPaginated<CKey[]>>' is not assignable to parameter of type 'OperatorFunction<HttpResponse<ListPaginated<CKey[]>>, ListPaginated<CKey[]>>'.
So I want to map the HttpResponse<CKey[]> to ListPaginated<CKey[]> But I don't know how can I transform it.
I inherited this code and I'm a newbie in typescript, so any suggestion is useful for me!
map?import { catchError, map } from 'rxjs/operators';mapwas imported from rxjs. But it appears to be the right one.