It is:
this.http.get<Category[]>(this.endpoint).pipe(
map(results => results.sort(...))
);
Or since sort
modifies existing array, it’s more semantically correct to provide side effects in do
/tap
:
this.http.get<Category[]>(this.endpoint).pipe(
tap(results => {
results.sort()
})
);