mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-11 03:27:47 +08:00
angular: gave a more precise return type to $q.all<T>()
This commit is contained in:
@@ -337,6 +337,16 @@ namespace TestQ {
|
||||
let result: angular.IPromise<{a: number; b: string; }>;
|
||||
result = $q.all<{a: number; b: string; }>({a: promiseAny, b: promiseAny});
|
||||
}
|
||||
{
|
||||
let result = $q.all({ num: $q.when(2), str: $q.when('test') });
|
||||
// TS should infer that num is a number and str is a string
|
||||
result.then(r => (r.num * 2) + r.str.indexOf('s'));
|
||||
}
|
||||
{
|
||||
let result = $q.all({ num: $q.when(2), str: 'test' });
|
||||
// TS should infer that num is a number and str is a string
|
||||
result.then(r => (r.num * 2) + r.str.indexOf('s'));
|
||||
}
|
||||
|
||||
// $q.defer
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user