mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 11:02:11 +08:00
angularjs: allow $q.when to be called w/o args
The current definition does not cover the case that the input type is void.
This commit is contained in:
@@ -139,6 +139,12 @@ module HttpAndRegularPromiseTests {
|
||||
dPromise.then((snack: string) => {
|
||||
$scope.snack = snack;
|
||||
});
|
||||
|
||||
// $q.when may be called without arguments
|
||||
var ePromise: ng.IPromise<Person> = $q.when();
|
||||
ePromise.then(() => {
|
||||
$scope.nothing = "really nothing";
|
||||
});
|
||||
}
|
||||
|
||||
// Test that we can pass around a type-checked success/error Promise Callback
|
||||
|
||||
6
angularjs/angular.d.ts
vendored
6
angularjs/angular.d.ts
vendored
@@ -565,6 +565,12 @@ declare module ng {
|
||||
* @param value Value or a promise
|
||||
*/
|
||||
when<T>(value: T): IPromise<T>;
|
||||
/**
|
||||
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
|
||||
*
|
||||
* @param value Value or a promise
|
||||
*/
|
||||
when(): IPromise<void>;
|
||||
}
|
||||
|
||||
interface IPromise<T> {
|
||||
|
||||
Reference in New Issue
Block a user