OK so I'm primarily a Angular 1.* developer and I thought I'd give angular 5 a try and so far I must say it is giving me hell. Way more complicated than it needs to be but anyhow....
So I make an HTTP call and I have this node API that returns something like this:
apiRoutes.route('/api/code').get(function (req, res) {
...
res.json({status: 200, code: FOO})
});
Meanwhile in Angular 5:
this.http.get(WEB_CONFIG.API_DOMAIN + 'api/code').subscribe(res => {
console.log(res) //<----- no error
console.log(res.code) //<---- Property 'code' does not exist on type 'Object' (WTF)
});
Why the heck can't I access any of the properties of res(At least at compile time according to VS Code)??? I can see 'res' json in the console if I omit the second log and run the app...