diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 4936f02e6e..fbcce34e81 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -368,7 +368,6 @@ namespace TestQ { result = $q.resolve(tResult); result = $q.resolve(promiseTResult); let result2: angular.IPromise = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther); - let result3: angular.IPromise> = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther); } // $q.when diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index d0e2d978dc..ec8e59b326 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -1049,6 +1049,10 @@ declare namespace angular { * @param value Value or a promise */ resolve(value: IPromise|T): IPromise; + /** + * @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(value: IPromise|T2): 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.