diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index 0174a0d61..de4414ad2 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -296,6 +296,17 @@ module TestQ { result = $q.reject(''); } + // $q.resolve + { + let result: angular.IPromise; + result = $q.resolve(); + } + { + let result: angular.IPromise; + result = $q.resolve(tResult); + result = $q.resolve(promiseTResult); + } + // $q.when { let result: angular.IPromise; diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 9f7fa07b0..9e554528a 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1052,12 +1052,20 @@ declare module angular { * * @param value Value or a promise */ - when(value: IPromise|T): IPromise; + resolve(value: IPromise|T): IPromise; + /** + * 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. + */ + resolve(): IPromise; /** * 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(value: IPromise|T): IPromise; + /** + * 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. + */ when(): IPromise; }