Deprecate incorrect resolve overload and usage

This commit is contained in:
Nathan Shively-Sanders
2017-06-19 09:30:38 -07:00
parent 18e5e1b05d
commit 37e41d33e4
2 changed files with 4 additions and 1 deletions

View File

@@ -368,7 +368,6 @@ namespace TestQ {
result = $q.resolve<TResult>(tResult);
result = $q.resolve<TResult>(promiseTResult);
let result2: angular.IPromise<TResult | TOther> = $q.resolve<TResult | TOther>(Math.random() > 0.5 ? tResult : promiseTOther);
let result3: angular.IPromise<TResult | TOther | angular.IPromise<TOther>> = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther);
}
// $q.when

View File

@@ -1049,6 +1049,10 @@ declare namespace angular {
* @param value Value or a promise
*/
resolve<T>(value: IPromise<T>|T): IPromise<T>;
/**
* @deprecated Since TS 2.4, inference is stricter and no longer produces the desired type when T1 !== T2.
* To use resolve with two different types, pass a union type to the single-type-argument overload.
*/
resolve<T1, T2>(value: IPromise<T1>|T2): IPromise<T1|T2>;
/**
* 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.