angularjs: changed $q.all() (added a type variable and tests)

This commit is contained in:
Ilya Mochalov
2015-08-07 23:36:27 +05:00
parent a95ee80de0
commit fcc892bba5
2 changed files with 14 additions and 1 deletions
+12
View File
@@ -242,6 +242,18 @@ foo.then((x) => {
x.toFixed();
});
// $q signature tests
module TestQ {
var $q: ng.IQService;
var promise1: ng.IPromise<any>;
var promise2: ng.IPromise<any>;
// $q.all
$q.all([promise1, promise2]).then((results: any[]) => {});
$q.all<number>([promise1, promise2]).then((results: number[]) => {});
$q.all({a: promise1, b: promise2}).then((results: {[id: string]: any;}) => {});
$q.all<{a: number; b: string;}>({a: promise1, b: promise2}).then((results: {a: number; b: string;}) => {});
}
var httpFoo: ng.IHttpPromise<number>;
httpFoo.then((x) => {