angular.d.ts: new interface IServiceProviderClass

Instead of IModule.provider simply accepting an Function for a class
constructor, use an interface to enforce the type of class.
This commit is contained in:
Nathan Brown
2014-06-18 17:49:05 -07:00
parent cba0e8f111
commit 492d456a36

View File

@@ -18,6 +18,11 @@ interface Function {
///////////////////////////////////////////////////////////////////////////////
declare module ng {
// not directly implemented, but ensures that constructed class implements $get
interface IServiceProviderClass {
new(...args: any[]): IServiceProvider;
}
// All service providers extend this interface
interface IServiceProvider {
$get: any;
@@ -140,9 +145,9 @@ declare module ng {
filter(name: string, filterFactoryFunction: Function): IModule;
filter(name: string, inlineAnnotatedFunction: any[]): IModule;
filter(object: Object): IModule;
provider(name: string, serviceProviderConstructor: Function): IModule;
provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule;
provider(name: string, inlineAnnotatedConstructor: any[]): IModule;
provider(name: string, providerObject: auto.IProvider): IModule;
provider(name: string, providerObject: IServiceProvider): IModule;
provider(object: Object): IModule;
run(initializationFunction: Function): IModule;
run(inlineAnnotatedFunction: any[]): IModule;
@@ -991,9 +996,6 @@ declare module ng {
// AUTO module (angular.js)
///////////////////////////////////////////////////////////////////////////
export module auto {
interface IProvider {
$get: any;
}
///////////////////////////////////////////////////////////////////////
// InjectorService