i am using httpClient:
get(url: string, options?:HttpOptionsInterface): Observable<HttpResponse<any>> {
return this.http.get(url, options).map((res: any) => {
return res;
}).catch((error: any) => {
if (error.status === 401) {
this.error401Handler();
}
return Observable.throw(error);
});
}
and this is my HttpOptionsInterface:
export interface HttpOptionsInterface {
headers?: HttpHeaders | {
[header: string]: string | string[];
};
observe?: 'response';
params?: HttpParams | {
[param: string]: string | string[];
};
reportProgress?: boolean;
responseType?: 'json';
withCredentials?: boolean;
}
but i got error:
error TS2345: Argument of type 'HttpOptionsInterface' is not assignable to parameter of type '{ headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: Ht...'.
Types of property 'observe' are incompatible. Type '"response"' is not assignable to type '"body"'.
sample stackblitz.