TypeScript Error: Cannot re-export name that is not defined in the module

When building an Angular2/TypeScript project in Visual Studio, you may encounter an error during the built:

1>node_modules\angular2\src\facade\promise.d.ts(2,10): error TS2661: Build: Cannot re-export name that is not defined in the module.

The error i thrown on this line:

static reject(obj: any, _: any): Promise;

To fix this issue, you need to declare Promise at the top of your promise.d.ts file:

declare var Promise: PromiseConstructor;
export { Promise };
export interface PromiseCompleter {
...

Hope this helps someone!

This entry was posted in Angular2, TypeScript and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *