I need to return a list of UI and I do this method:
getList(): Observable<UI[]> {
return this.httpClient.get("/api/listui").pipe(map(
(response:Response) => { return response.json(); },
),
catchError((error) => { return throwError(error); }));
}
In my vs code the error appears as:
"Type 'Observable<UI[] | Promise<any>>' is not assignable to type 'Observable<UI[]>'. Type 'UI[] | Promise<any>' is not assignable to type 'UI[]'."
Anyone can help to resolve this?
httpClient will return json data by default you don't need to do this return response.json();
getList(): Observable<UI[]> {
return this.httpClient.get("/api/listui").pipe(
catchError((error) => { return throwError(error); }));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With