From 18e5e1b05d470010a5309f320aae1c7932f51526 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 16 Jun 2017 10:53:33 -0700 Subject: [PATCH] Fix angular tests for 2.4's improved generic checking --- types/angular/angular-tests.ts | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index d77c18fa37..4936f02e6e 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -367,8 +367,8 @@ namespace TestQ { let result: angular.IPromise; result = $q.resolve(tResult); result = $q.resolve(promiseTResult); - result = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther); - result = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther); + 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 @@ -378,7 +378,8 @@ namespace TestQ { } { let result: angular.IPromise; - let resultOther: angular.IPromise; + let other: angular.IPromise; + let resultOther: angular.IPromise; result = $q.when(tResult); result = $q.when(promiseTResult); @@ -388,20 +389,21 @@ namespace TestQ { result = $q.when(tValue, (result: TValue) => tResult, (any) => any, (any) => any); result = $q.when(promiseTValue, (result: TValue) => tResult); - result = resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => tOther); - result = resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => tOther, (any) => any); - result = resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther); - result = resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther, (any) => any); + resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => tOther); + resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => tOther); + resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => tOther, (any) => any); + resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther); + resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther, (any) => any); result = $q.when(tValue, (result: TValue) => promiseTResult); result = $q.when(tValue, (result: TValue) => promiseTResult, (any) => any); result = $q.when(tValue, (result: TValue) => promiseTResult, (any) => any, (any) => any); result = $q.when(promiseTValue, (result: TValue) => promiseTResult); - result = resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther); - result = resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther, (any) => any); - result = resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther); - result = resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther, (any) => any); + resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther); + resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther, (any) => any); + resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther); + resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther, (any) => any); } } @@ -547,7 +549,7 @@ namespace TestPromise { assertPromiseType(promise.then((result) => result, (any) => any, (any) => any)); assertPromiseType(promise.then((result) => result, (any) => reject, (any) => any)); - assertPromiseType(promise.then((result) => anyOf2(reject, result))); + assertPromiseType | TResult>(promise.then((result) => anyOf2(reject, result))); assertPromiseType(promise.then((result) => anyOf3(result, tresultPromise, reject))); assertPromiseType(promise.then( (result) => anyOf3(reject, result, tresultPromise), @@ -557,7 +559,7 @@ namespace TestPromise { assertPromiseType>(promise.then((result) => tresultHttpPromise)); assertPromiseType(promise.then((result) => result, (any) => tother)); - assertPromiseType(promise.then( + assertPromiseType | angular.IPromise | TOther | angular.IPromise>(promise.then( (result) => anyOf3(reject, result, totherPromise), (reason) => anyOf3(reject, tother, tresultPromise) )); @@ -588,7 +590,7 @@ namespace TestPromise { assertPromiseType(promise.catch((err) => err)); assertPromiseType(promise.catch((err) => any)); assertPromiseType(promise.catch((err) => tresult)); - assertPromiseType(promise.catch((err) => anyOf2(tresult, reject))); + assertPromiseType>(promise.catch((err) => anyOf2(tresult, reject))); assertPromiseType(promise.catch((err) => anyOf3(tresult, tresultPromise, reject))); assertPromiseType(promise.catch((err) => tresultPromise)); assertPromiseType>(promise.catch((err) => tresultHttpPromise));