diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index 2322bb84ca..4d95c26644 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -377,34 +377,48 @@ module TestPromise { b: string; c: boolean; } + interface TOther { + d: number; + e: string; + f: boolean; + } + var tresult: TResult; + var tresultPromise: ng.IPromise; + + var tother: TOther; + var totherPromise: ng.IPromise; + var promise: angular.IPromise; - interface IPromiseSuccessCallback { - (promiseValue: T): angular.IHttpPromise|angular.IPromise|U|angular.IPromise; - } - var successCallbackAnyFn: IPromiseSuccessCallback; - var successCallbackTResultFn: IPromiseSuccessCallback; - interface IPromiseErrorCallback { - (error: any): angular.IHttpPromise|angular.IPromise|T; - } - var errorCallbackAnyFn: IPromiseErrorCallback; - var errorCallbackTResultFn: IPromiseErrorCallback; // promise.then - result = >promise.then(successCallbackAnyFn); - result = >promise.then(successCallbackAnyFn, (any) => any); - result = >promise.then(successCallbackAnyFn, (any) => any, (any) => any); - result = >promise.then(successCallbackTResultFn); - result = >promise.then(successCallbackTResultFn, (any) => any); - result = >promise.then(successCallbackTResultFn, (any) => any, (any) => any); - + result = >promise.then((result) => any); + result = >promise.then((result) => any, (any) => any); + result = >promise.then((result) => any, (any) => any, (any) => any); + + result = >promise.then((result) => result); + result = >promise.then((result) => result, (any) => any); + result = >promise.then((result) => result, (any) => any, (any) => any); + result = >promise.then((result) => tresultPromise); + result = >promise.then((result) => tresultPromise, (any) => any); + result = >promise.then((result) => tresultPromise, (any) => any, (any) => any); + + result = >promise.then((result) => tother); + result = >promise.then((result) => tother, (any) => any); + result = >promise.then((result) => tother, (any) => any, (any) => any); + result = >promise.then((result) => totherPromise); + result = >promise.then((result) => totherPromise, (any) => any); + result = >promise.then((result) => totherPromise, (any) => any, (any) => any); + // promise.catch - result = >promise.catch(errorCallbackAnyFn); - result = >promise.catch(errorCallbackTResultFn); + result = >promise.catch((err) => any); + result = >promise.catch((err) => tresult); + result = >promise.catch((err) => tother); // promise.finally - result = >promise.finally(() => any); - result = >promise.finally(() => any); + result = >promise.finally(() => any); + result = >promise.finally(() => tresult); + result = >promise.finally(() => tother); } diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 0dc9ca2caf..7c6bc21556 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1061,7 +1061,7 @@ declare module angular { * * Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible. */ - finally(finallyCallback: () => any): IPromise; + finally(finallyCallback: () => any): IPromise; } interface IDeferred {