Skip to content

Commit 861be30

Browse files
committed
feat: export a proper promise type.
Promise used to be typed as any, giving incorrect results. This change fixes places that were incorrectly typed and re-exports the actual Promise type from es6-promise. It also fixes a series of compilation errors discovered/triggered by this change.
1 parent 27aa918 commit 861be30

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

modules/angular2/src/facade/async.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {global, isPresent} from 'angular2/src/facade/lang';
55
import {List} from 'angular2/src/facade/collection';
66
import * as Rx from 'rx';
77

8-
export var Promise = (<any>global).Promise;
8+
export {Promise};
99

1010
export interface PromiseCompleter<R> {
1111
promise: Promise<R>;

modules/angular2/test/facade/async_spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,13 @@ export function main() {
7777
PromiseWrapper.then(one.promise, (_) => {
7878
expect(allCalled).toBe(false);
7979
two.resolve('two');
80+
return null;
8081
});
8182

8283
PromiseWrapper.then(all, (_) => {
8384
allCalled = true;
8485
async.done();
86+
return null;
8587
});
8688

8789
one.resolve('one');

0 commit comments

Comments
 (0)