diff --git a/inversify/interfaces.d.ts b/inversify/interfaces.d.ts new file mode 100644 index 000000000..eeaa14faf --- /dev/null +++ b/inversify/interfaces.d.ts @@ -0,0 +1,13 @@ +interface TypeBindingInterface { + runtimeIdentifier : string; + implementationType : { new(): TServiceType ;}; + cache : TServiceType; + scope : number; // TypeBindingScopeEnum +} + +interface KernelInterface { + bind(typeBinding : TypeBindingInterface) : void; + unbind(runtimeIdentifier : string) : void; + unbindAll() : void; + resolve(runtimeIdentifier : string) : TImplementationType; +} diff --git a/inversify/inversify.d.ts b/inversify/inversify.d.ts new file mode 100644 index 000000000..9c0405298 --- /dev/null +++ b/inversify/inversify.d.ts @@ -0,0 +1,37 @@ +/// + +declare enum TypeBindingScopeEnum { + Transient = 0, + Singleton = 1, +} + +declare class TypeBinding implements TypeBindingInterface { + runtimeIdentifier: string; + implementationType: { + new (): TServiceType; + }; + cache: TServiceType; + scope: TypeBindingScopeEnum; + constructor(runtimeIdentifier: string, implementationType: { + new (...args: any[]): TServiceType; + }, scopeType?: TypeBindingScopeEnum); +} + +declare class Kernel implements KernelInterface { + private _bindings; + bind(typeBinding: TypeBindingInterface): void; + unbind(runtimeIdentifier: string): void; + unbindAll(): void; + resolve(runtimeIdentifier: string): TImplementationType; + private _validateBinding(typeBinding); + private _getConstructorArguments(func); + private _injectDependencies(func); + private _construct(constr, args); + constructor(); +} + +declare var inversify: { + Kernel: typeof Kernel; + TypeBindingScopeEnum: typeof TypeBindingScopeEnum; + TypeBinding: typeof TypeBinding; +};