I cannot build my Angular4 project because of that error that I really don't understand. I have my imports like Response, Headers, Http from @angular. When I'm trying to build my project I get this error:
TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'Response' is not a valid type argument because it is not a supertype of candidate 'Response'. Types of property 'type' are incompatible. Type 'string' is not assignable to type 'ResponseType'.
It refers to this code:
public getPatients(): Observable<any> {
//noinspection TypeScriptValidateTypes
return this.http.get(AppSettings.API_ENDPOINT + 'patient', { headers: this.getHeaders() })
.map((res:Response) => res.json())
.catch((error) => Observable.throw(error.json().error || "Server error"));
}
I found a workaround with imports and I added all mentioned in those threads but it still doesn't help.
http.get().map(), and tell us what line produces the error? I suspect the inferred type of the returned value of thecatch().