I'm new to angular and npm, but when learning, I got an error, with a code that seems to work on the source I'm trying to reproduce(here).
I assume this has to do with my development environment but I can't exactly understand why.
This is my code:
return this.http.get('api/cards.json')
.map((response:Response) => <Card[]>response.json().data)
.do(data=>console.log(data))
.catch(this.handleError);
On the .map
, Visual Studio Code give me this error:
ts Property 'map' does not exist on type 'Observable'
If I ignore this error and go to the browser, I've the same message.
I've created my project with the angular-cli
, and my angular-version is actually the 2.4.4. The server is running with the ng serve
tool.
I've made somes searches:
property map does not exist on observable response in angular --> I don't use visual studio 2015, also, I'm up to date with my Visual Studio Code(also it seems the bug has ben solved since a while).
Angular 2 2.0.0-rc.1 Property 'map' does not exist on type 'Observable<Response>' not the same as issue report --> My commandline doesn't know anything about tsc
and after I've done the npm i typescript -g
(and restarted both VS code
and the ng serve
Any idea what is going wrong(I suppose something is not up to date, but I don't know what and how to update it).