mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Deprecate incorrect resolve overload and usage
This commit is contained in:
@@ -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
|
||||
|
||||
4
types/angular/index.d.ts
vendored
4
types/angular/index.d.ts
vendored
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user