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.
This commit is contained in:
Martin Probst 2015-06-23 22:02:20 -07:00
parent 27aa9187f0
commit 861be30021
2 changed files with 3 additions and 1 deletions

View File

@ -5,7 +5,7 @@ import {global, isPresent} from 'angular2/src/facade/lang';
import {List} from 'angular2/src/facade/collection'; import {List} from 'angular2/src/facade/collection';
import * as Rx from 'rx'; import * as Rx from 'rx';
export var Promise = (<any>global).Promise; export {Promise};
export interface PromiseCompleter<R> { export interface PromiseCompleter<R> {
promise: Promise<R>; promise: Promise<R>;

View File

@ -77,11 +77,13 @@ export function main() {
PromiseWrapper.then(one.promise, (_) => { PromiseWrapper.then(one.promise, (_) => {
expect(allCalled).toBe(false); expect(allCalled).toBe(false);
two.resolve('two'); two.resolve('two');
return null;
}); });
PromiseWrapper.then(all, (_) => { PromiseWrapper.then(all, (_) => {
allCalled = true; allCalled = true;
async.done(); async.done();
return null;
}); });
one.resolve('one'); one.resolve('one');