You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit to TypeScript seems to have caused problems on the first line of promise.d.ts complaining that Promise cannot be exported as it is not defined in this file:
ERROR in [default] /path/to/project/node_modules/angular2/src/facade/promise.d.ts:1:9
Cannot re-export name that is not defined in the module.
Reacted by Nicolas Molina Monroy, xaun and Petronel MALUTAN (p.m)
+1
This needs to be fixed ASAP
Looks like that file (promise.d.ts) isn't in line with ES6 specs;
TSC 1.8 aligned themselves with those specs and it now throws that error (it wasn't in 1.7.*)
We need to use TSC 1.8 for various reasons and it is currently breaking our builds
As it's a TypeScript compile warning your Angular 2 application will still transpile and work without any problems, so for the meantime you can also ignore the error instead of editing any of Angular 2's type definition files.
As @wardbell stated this is an error for the typescript compiler, and it exits with status 2 instead of 0, which means that if your typescript compilation is part of a publish/testing process it will fail.
I need to use TypeScript 1.7.5 until this is fixed and it's a shame because 1.8 introduces modules bundling which I need for my lib.
Thanks for the clarification @wardbell. My current project isn't being built as part of any CI pipeline so I hadn't thought of this. I agree, this does need to be fixed soon and hopefully it will be.
@alexeagle sorry if this is a terribly stupid question, but I am still encountering this same problem. When I check my latest Angular version using "npm angular --version" it says 3.8.1. I know the latest is beta.9. How do I upgrade to beta.9? I can't seem to do it anywhere.
@MattDHill do npm install angular2@latest --save. The result you get sounds to be npm version itself. After you do that you can see in package.json the version installed.
adding declare var Promise: PromiseConstructor; on the top of promise.d.ts file on your project.
this solution come to me from the previous comments on this issue. thanks to all
Activity
du5rte commentedon Jan 21, 2016
+1 any idea what's causing it? I had to moved back to 1.7.5
MarkoSulamagi commentedon Jan 23, 2016
+1
josephwoodward commentedon Jan 29, 2016
I appear to be getting the same problem. It was all working fine until I upgraded.
Here's the contents of my tsconfig file if it helps:
*Edit: After a bit of digging it looks like the Angular team are aware of it: microsoft/TypeScript#6178 (comment)
xiaopengli89 commentedon Jan 29, 2016
I solve this problem by adding
declare var Promise: PromiseConstructor;on the top ofpromise.d.tsOClement commentedon Jan 29, 2016
+1
This needs to be fixed ASAP
Looks like that file (promise.d.ts) isn't in line with ES6 specs;
TSC 1.8 aligned themselves with those specs and it now throws that error (it wasn't in 1.7.*)
We need to use TSC 1.8 for various reasons and it is currently breaking our builds
servicepartnerplatform commentedon Jan 29, 2016
sicaner's solution worked for me!
josephwoodward commentedon Jan 30, 2016
As it's a TypeScript compile warning your Angular 2 application will still transpile and work without any problems, so for the meantime you can also ignore the error instead of editing any of Angular 2's type definition files.
wardbell commentedon Jan 30, 2016
@josephwoodward I wish that TS compiler distinguished "real" errors from mere warnings.
It doesn't. This bombs the CI process. Needs to be fixed and soon.
ocombe commentedon Jan 31, 2016
As @wardbell stated this is an error for the typescript compiler, and it exits with status 2 instead of 0, which means that if your typescript compilation is part of a publish/testing process it will fail.
I need to use TypeScript 1.7.5 until this is fixed and it's a shame because 1.8 introduces modules bundling which I need for my lib.
marcinnajder commentedon Feb 1, 2016
+1
josephwoodward commentedon Feb 1, 2016
Thanks for the clarification @wardbell. My current project isn't being built as part of any CI pipeline so I hadn't thought of this. I agree, this does need to be fixed soon and hopefully it will be.
61 remaining items
MattDHill commentedon Mar 16, 2016
@alexeagle sorry if this is a terribly stupid question, but I am still encountering this same problem. When I check my latest Angular version using "npm angular --version" it says 3.8.1. I know the latest is beta.9. How do I upgrade to beta.9? I can't seem to do it anywhere.
ericmartinezr commentedon Mar 16, 2016
@MattDHill do
npm install angular2@latest --save. The result you get sounds to be npm version itself. After you do that you can see in package.json the version installed.alexeagle commentedon Mar 16, 2016
right,
npm angularis not an npm command, probably you should get anerror instead.
On Wed, Mar 16, 2016 at 12:07 PM ericmartinezr [email protected]
wrote:
vukasin-nikodijevic commentedon Mar 29, 2016
Still issue in [email protected]
alexeagle commentedon Mar 29, 2016
@Vukasin0 doesn't matter what version of TypeScript, any 1.8 branch will have this problem unless you update angular2 past beta.7
nicobytes commentedon Apr 5, 2016
I have the same error, What is solution?

mikepc commentedon Apr 7, 2016
npm install --save [email protected] [email protected] [email protected]
This successfully builds and runs without this error, but I haven't run a full regression on it or anything, but it seems to be working for me.
russellf9 commentedon Apr 14, 2016
Working from the latest development build:
npm i typescript@next -DAdrienTorris commentedon Apr 20, 2016
Same issue with typescript 1.7.1, angular 2.0.0-beta1 et rxjs 5.0.0-beta.1, solved with @sicaner's solution.
AdrienTorris commentedon Apr 20, 2016
TypeScript changelog
Huthaifah-kholi commentedon Nov 28, 2016
it solve for me after doing this commands :
typescript@nextwhich update typescript.var Promise: PromiseConstructor;on the top of promise.d.ts file on your project.this solution come to me from the previous comments on this issue. thanks to all
malutanpetronel commentedon May 22, 2017
A bit redundant ? It should be re-changed if you will run again npm install to add some other packages ?
usernamealreadyis commentedon May 29, 2017
invalid link #17071 @x-friday
angular-automatic-lock-bot commentedon Sep 11, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.