mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Added generics to IHttpPromise and some missing properties/overloads
I know you haven't used generics so far so I hope this is a welcome change - the only nuisance is that it will "break" current compilation but will increase type safety by far. Also added params to ICurrentRoute and inline injection notation to $provide.decorator as per https://github.com/borisyankov/DefinitelyTyped/issues/799
This commit is contained in:
Vendored
+11
-8
@@ -537,21 +537,21 @@ declare module ng {
|
||||
transformResponse?: any;
|
||||
}
|
||||
|
||||
interface IHttpPromiseCallback {
|
||||
(data: any, status: number, headers: (headerName: string) => string, config: IRequestConfig): any;
|
||||
interface IHttpPromiseCallback<T> {
|
||||
(data: T, status: number, headers: (headerName: string) => string, config: IRequestConfig): any;
|
||||
}
|
||||
|
||||
interface IHttpPromiseCallbackArg {
|
||||
data?: any;
|
||||
interface IHttpPromiseCallbackArg<T> {
|
||||
data?: T;
|
||||
status?: number;
|
||||
headers?: (headerName: string) => string;
|
||||
config?: IRequestConfig;
|
||||
}
|
||||
|
||||
interface IHttpPromise extends IPromise {
|
||||
success(callback: IHttpPromiseCallback): IHttpPromise;
|
||||
error(callback: IHttpPromiseCallback): IHttpPromise;
|
||||
then(successCallback: (response: IHttpPromiseCallbackArg) => any, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise;
|
||||
interface IHttpPromise<T> extends IPromise {
|
||||
success(callback: IHttpPromiseCallback<T>): IHttpPromise;
|
||||
error(callback: IHttpPromiseCallback<T>): IHttpPromise;
|
||||
then(successCallback: (response: IHttpPromiseCallbackArg<T>) => any, errorCallback?: (response: IHttpPromiseCallbackArg<T>) => any): IPromise;
|
||||
}
|
||||
|
||||
interface IHttpProvider extends IServiceProvider {
|
||||
@@ -639,6 +639,8 @@ declare module ng {
|
||||
$scope: IScope;
|
||||
$template: string;
|
||||
};
|
||||
|
||||
params: any;
|
||||
}
|
||||
|
||||
interface IRouteProvider extends IServiceProvider {
|
||||
@@ -693,6 +695,7 @@ declare module ng {
|
||||
constant(name: string, value: any): void;
|
||||
|
||||
decorator(name: string, decorator: Function): void;
|
||||
decorator(name: string, decoratorInline: any[]): void;
|
||||
factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider;
|
||||
provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider;
|
||||
provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider;
|
||||
|
||||
Reference in New Issue
Block a user