mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-01 11:50:54 +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
|
||||
|
||||
Vendored
+1
@@ -455,6 +455,7 @@ declare module ng {
|
||||
all(promises: {[id: string]: IPromise<any>;}): IPromise<{[id: string]: any}>;
|
||||
defer<T>(): IDeferred<T>;
|
||||
reject(reason?: any): IPromise<void>;
|
||||
when<T>(value: IPromise<T>): IPromise<T>;
|
||||
when<T>(value: T): IPromise<T>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user