I have a problem very similar to : Why is Angular not choosing correct overload for HttpClient.get(...)?
and this:
Angular HttpClient return expecting observable<HttpEvent<any> rather than observable<any>
but neither of those solutions are working.
My code looks like this:
getTopology(): Observable<Topology> {
var me = this;
let headers = new HttpHeaders({
'Content-Type': 'application/json'
});
let params = new HttpParams();
let options = {headers: headers, params: params};
let url = this.url;
return this.http.getTyped<Topology>(url, options);
}
getTyped<T>(
url: string,
options: {
headers: HttpHeaders;
observe?: 'body';
params?: HttpParams;
reportProgress?: boolean;
responseType?: 'json';
withCredentials?: boolean;
},
signRequest = true
): Observable<T> {
options.headers = options.headers.append(
'Authorization',
`Bearer ${localStorage.getItem('token')}`
);
return this.http.get<T>(url, options);
}
It is pointing to this get:
get(url: string, options?: {
headers?: HttpHeaders | {
[header: string]: string | string[];
};
observe?: 'body';
params?: HttpParams | {
[param: string]: string | string[];
};
reportProgress?: boolean;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<Object>;
Instead of this get:
get<T>(url: string, options?: {
headers?: HttpHeaders | {
[header: string]: string | string[];
};
observe?: 'body';
params?: HttpParams | {
[param: string]: string | string[];
};
reportProgress?: boolean;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<T>;
Any suggestions? Also I am using Angular 6.0.6