In my angular 4 project I am using HTTP Client, when I have a GET call the response is sometimes articulated so I have to do something like:
this.loggedUser.name = response._embedded.agent.name
But in this case I have this error:
Property '_embedded' does not exist on type 'HttpResponse'
I resolve the problem with casting the response to any:
getLoggedUser(url) {
return this.http.get(url, {observe: 'response'})
.map((response) => <any>response);
}
So, Did I have to cast to any all the response? Is this considered good practice, or should I be doing something else?