Fix angular tests for 2.4's improved generic checking

This commit is contained in:
Nathan Shively-Sanders
2017-06-16 10:53:33 -07:00
parent 2099f15798
commit 18e5e1b05d
+16 -14
View File
@@ -367,8 +367,8 @@ namespace TestQ {
let result: angular.IPromise<TResult>;
result = $q.resolve<TResult>(tResult);
result = $q.resolve<TResult>(promiseTResult);
result = $q.resolve<TResult | TOther>(Math.random() > 0.5 ? tResult : promiseTOther);
result = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther);
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
@@ -378,7 +378,8 @@ namespace TestQ {
}
{
let result: angular.IPromise<TResult>;
let resultOther: angular.IPromise<TOther>;
let other: angular.IPromise<TOther>;
let resultOther: angular.IPromise<TResult | TOther>;
result = $q.when<TResult>(tResult);
result = $q.when<TResult>(promiseTResult);
@@ -388,20 +389,21 @@ namespace TestQ {
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult, (any) => any, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther, (any) => any);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther, (any) => any);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther, (any) => any);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther, (any) => any);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther, (any) => any);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther, (any) => any);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther, (any) => any);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther, (any) => any);
}
}
@@ -547,7 +549,7 @@ namespace TestPromise {
assertPromiseType<TResult>(promise.then((result) => result, (any) => any, (any) => any));
assertPromiseType<TResult>(promise.then((result) => result, (any) => reject, (any) => any));
assertPromiseType<TResult>(promise.then((result) => anyOf2(reject, result)));
assertPromiseType<angular.IPromise<never> | TResult>(promise.then((result) => anyOf2(reject, result)));
assertPromiseType<TResult>(promise.then((result) => anyOf3(result, tresultPromise, reject)));
assertPromiseType<TResult>(promise.then(
(result) => anyOf3(reject, result, tresultPromise),
@@ -557,7 +559,7 @@ namespace TestPromise {
assertPromiseType<ng.IHttpPromiseCallbackArg<TResult>>(promise.then((result) => tresultHttpPromise));
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother));
assertPromiseType<TResult | TOther>(promise.then(
assertPromiseType<TResult | angular.IPromise<TResult> | angular.IPromise<never> | TOther | angular.IPromise<TOther>>(promise.then(
(result) => anyOf3(reject, result, totherPromise),
(reason) => anyOf3(reject, tother, tresultPromise)
));
@@ -588,7 +590,7 @@ namespace TestPromise {
assertPromiseType<any>(promise.catch((err) => err));
assertPromiseType<any>(promise.catch((err) => any));
assertPromiseType<TResult>(promise.catch((err) => tresult));
assertPromiseType<TResult>(promise.catch((err) => anyOf2(tresult, reject)));
assertPromiseType<TResult | angular.IPromise<never>>(promise.catch((err) => anyOf2(tresult, reject)));
assertPromiseType<TResult>(promise.catch((err) => anyOf3(tresult, tresultPromise, reject)));
assertPromiseType<TResult>(promise.catch((err) => tresultPromise));
assertPromiseType<TResult | ng.IHttpPromiseCallbackArg<TResult>>(promise.catch((err) => tresultHttpPromise));