From c2a19737cbb9ce136088bae82df4b2ecb867687d Mon Sep 17 00:00:00 2001 From: anchann Date: Tue, 3 Sep 2013 14:51:57 +0900 Subject: [PATCH] AngularJS: fixing http promise typings Looks like defining only a single overload of the then function on the IHttpPromise interface is making the other overload of it defined on IPromise invisible to the compiler. As such, we need to expose both versions. Otherwise, the standard promise unwrapping behaviour does not type check correctly. --- angularjs/angular.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 429a79b483..140e56eee9 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -518,8 +518,8 @@ declare module ng { pendingRequests: any[]; } - // This is just for hinting. - // Some opetions might not be available depending on the request. + // This is just for hinting. + // Some opetions might not be available depending on the request. // see http://docs.angularjs.org/api/ng.$http#Usage for options explanations interface IRequestConfig { method: string; @@ -550,10 +550,11 @@ declare module ng { config?: IRequestConfig; } - interface IHttpPromise extends IPromise { + interface IHttpPromise extends IPromise { success(callback: IHttpPromiseCallback): IHttpPromise; error(callback: IHttpPromiseCallback): IHttpPromise; then(successCallback: (response: IHttpPromiseCallbackArg) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; + then(successCallback: (response: IHttpPromiseCallbackArg) => IPromise, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; } interface IHttpProvider extends IServiceProvider {