Merge pull request #5200 from use-strict/angular-remove-any

angularjs - Switched any to generics for type safety.
This commit is contained in:
Basarat Ali Syed
2015-08-06 16:08:37 +10:00
2 changed files with 10 additions and 11 deletions
Executable → Regular
+2 -2
View File
@@ -30,7 +30,7 @@ class AuthService {
'$rootScope', '$injector', <any>function($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) {
var $http: ng.IHttpService; //initialized later because of circular dependency problem
function retry(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
$http = $http || $injector.get('$http');
$http = $http || $injector.get<ng.IHttpService>('$http');
$http(config).then(function (response) {
deferred.resolve(response);
});
@@ -285,7 +285,7 @@ test_IAttributes({
$addClass: function (classVal){},
$removeClass: function(classVal){},
$set: function(key, value){},
$observe: function(name, fn){
$observe: function(name: any, fn: any){
return fn;
},
$attr: {}
Vendored Executable → Regular
+8 -9
View File
@@ -237,7 +237,7 @@ declare module angular {
forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any;
fromJson(json: string): any;
identity(arg?: any): any;
identity<T>(arg?: T): T;
injector(modules?: any[], strictDi?: boolean): auto.IInjectorService;
isArray(value: any): boolean;
isDate(value: any): boolean;
@@ -453,7 +453,7 @@ declare module angular {
* following compilation. The observer is then invoked whenever the
* interpolated value changes.
*/
$observe(name: string, fn: (value?: any) => any): Function;
$observe<T>(name: string, fn: (value?: T) => any): Function;
/**
* A map of DOM element attribute names to the normalized name. This is needed
@@ -725,7 +725,7 @@ declare module angular {
// see http://docs.angularjs.org/api/ng.$timeout
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
(func: Function, delay?: number, invokeApply?: boolean): IPromise<any>;
<T>(func: (...args: any[]) => T, delay?: number, invokeApply?: boolean): IPromise<T>;
cancel(promise: IPromise<any>): boolean;
}
@@ -996,8 +996,7 @@ declare module angular {
* See http://docs.angularjs.org/api/ng/service/$q
*/
interface IQService {
new (resolver: (resolve: IQResolveReject<any>) => any): IPromise<any>;
new (resolver: (resolve: IQResolveReject<any>, reject: IQResolveReject<any>) => any): IPromise<any>;
new <T>(resolver: (resolve: IQResolveReject<T>) => any): IPromise<T>;
new <T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>;
/**
@@ -1156,7 +1155,7 @@ declare module angular {
*
* @param key the key of the data to be retrieved
*/
get(key: string): any;
get<T>(key: string): T;
/**
* Removes an entry from the Cache object.
@@ -1587,7 +1586,7 @@ declare module angular {
scope: IScope,
instanceElement: IAugmentedJQuery,
instanceAttributes: IAttributes,
controller: any,
controller: {},
transclude: ITranscludeFunction
): void;
}
@@ -1682,9 +1681,9 @@ declare module angular {
interface IInjectorService {
annotate(fn: Function): string[];
annotate(inlineAnnotatedFunction: any[]): string[];
get(name: string): any;
get<T>(name: string): T;
has(name: string): boolean;
instantiate(typeConstructor: Function, locals?: any): any;
instantiate<T>(typeConstructor: Function, locals?: any): T;
invoke(inlineAnnotatedFunction: any[]): any;
invoke(func: Function, context?: any, locals?: any): any;
}