Reputation: 40896
Writing an Angular 2 app in TypeScript, I'm trying to follow the 5 Min Quickstart guide. Recently the npm typings
package went from 0.x to 1.x. According to the official instructions, we are supposed to delete /typings
when upgrading so that's what I did. After deleting that directory, I ran npm uninstall typings
, then npm install typings
. I now have typings 1.1.0
installed.
Here is my typings.json
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
"node": "registry:dt/node#4.0.0+20160509154515"
}
}
Problem is, I expected the installation to create a new /typings
and fill it with the new file structure. However, I still have no /typings
. Trying to run typings install
throws the error 'typings' is not a recognized command, program or batch file
(I'm on Windows 7). What gives?
Why it's a problem: The typescript compiler throws a lot of "Cannot find name 'Promise'" (or 'Set' or 'Map')
errors unless I reference the (now deleted) ///<reference path="../typings/main/ambient/es6-shim/es6-shim.d.ts"/>
Upvotes: 0
Views: 574
Reputation: 16157
I had this issue too a while back. To fix it I added
///<reference path="../../node_modules/angular2-in-memory-web-api/typings/browser.d.ts" />
this reference path to tsd.d.ts
file. The path might be different depending on how your environment is set up. But if I remember right browser.d.ts
had the references for those typings.
Here is a related issue pre-release candidate. Angular 2 can't find Promise,Map,Set and Iterator
Upvotes: 0
Reputation: 40896
typings install
would not be recognized (probably because I don't have it installed globally). To create and fill /typings
, I needed to execute npm run typings install
. This created /typings/globals
and filled it with the packages in my typings.json
.
In order to deal with the "Cannot find name 'Promise'" errors, I then changed the reference path I had in my bootstrap file to
the old: ///<reference path="../typings/main/ambient/es6-shim/es6-shim.d.ts"/>
to the new: ///<reference path="../typings/globals/core-js/index.d.ts"/>
Given that Angular 2 replaced es6-shim
with core-js
in typings.json
recently
Upvotes: 1