proxydi
Version:
A typed hierarchical DI container that resolves circular dependencies via Proxy
18 lines (17 loc) • 1.15 kB
TypeScript
import { DependencyClass, DependencyId } from './types';
export declare const injectableClasses: Record<DependencyId, DependencyClass<any>>;
export declare const constructorInjections: Record<DependencyId, DependencyId[]>;
/**
* Registers a class as an automatically injectable for dependency injection container.
*
* @param dependencyId - Optional dependency identifier. If omitted, the class name is used.
* @param autoInjecions - injections that should be injected to dependency constructor while it creates
* @returns A class decorator function.
*
* Note: During dependency resolution, any container that does not have an instance for the specified dependency identifier
* will create an instance of the decorated class. However, if a container already has an instance with that identifier
* prior to resolution, the decorated class will be ignored by that container.
*/
export declare function injectable(autoInjecions: DependencyId[]): any;
export declare function injectable(dependencyId?: DependencyId, autoInjecions?: DependencyId[]): any;
export declare function findInjectableId(injectable: DependencyClass<any>): DependencyId;