public get<T>(url: string, httpParams: Array<Map<string, string>>): Observable<T> {
return this.httpClient
.get<T>(url, { params: this.appendHttpParams(httpParams), headers: this.httpHeaders })
.catch((error, some): any => {
console.log(error);
});
}
I have this wrapper function around my http service in Angular 4. It works fine without the return type specified. However, if I provide the same return type of the 'httpClient.get()' which is Observable, it throws an error
[ts] Type 'Observable<{} | T>' is not assignable to type 'Observable'. Type '{} | T' is not assignable to type 'T'. Type '{}' is not assignable to type 'T'.
What am I missing?