mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 20:39:17 +08:00
Fix $q.when definition
This commit is contained in:
@@ -94,6 +94,7 @@ module HttpAndRegularPromiseTests {
|
||||
person: Person;
|
||||
theAnswer: number;
|
||||
letters: string[];
|
||||
snack: string;
|
||||
}
|
||||
|
||||
var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => {
|
||||
@@ -132,6 +133,12 @@ module HttpAndRegularPromiseTests {
|
||||
cPromise.then((letters: string[]) => {
|
||||
$scope.letters = letters;
|
||||
});
|
||||
|
||||
// When $q.when is passed an IPromise<T>, it returns an IPromise<T>
|
||||
var dPromise: ng.IPromise<string> = $q.when($q.when("ALBATROSS!"));
|
||||
dPromise.then((snack: string) => {
|
||||
$scope.snack = snack;
|
||||
});
|
||||
}
|
||||
|
||||
// Test that we can pass around a type-checked success/error Promise Callback
|
||||
|
||||
Reference in New Issue
Block a user