I have this block of code here:
this._auth.getToken().flatMap(token => {
return this._http.post("/authenticate");
}).flatMap(res => {
let headers = new Headers();
headers.append("Content-Type", "application/json");
headers.append("Authorization", res.json().Token);
return this._http.get(this.endpoints[endpoint], {headers: headers});
});
http.get and http.post return an Observable<Response> which contains a .json method
However flatMap returns an Observable<Any> which doesn't contain the .json method.
It works correctly, but TSlint complains with:
Property 'json' does not exist on type '{}'.at line 32 col 49
Am I doing something wrong? Is this expected? It's not a big deal but maybe it's a symptom of bigger issues in the code.