export type Constructable = new (...args: any[]) => T; export type AbstractConstructable = NewableFunction & { prototype: T; }; export type Identifier = AbstractConstructable | Constructable | string | symbol; export declare enum ScopeEnum { SINGLETON = "singleton", EXECUTION = "execution", TRANSIENT = "transient" } export interface InjectOptions { id?: Identifier; noThrow?: boolean; defaultValue?: any; lazy?: boolean; } export interface InjectableOption { id?: Identifier; scope?: ScopeEnum; lazy?: boolean; scopeEscape?: boolean; } export interface InjectableDefinition { id: Identifier; scope: ScopeEnum; type?: Constructable | null; value?: unknown; /** * Indicates whether a new instance should be created as soon as the class is registered. * By default the registered classes are only instantiated when they are requested from the container. */ eager?: boolean; factory?: (id: Identifier, container?: ContainerType) => any; scopeEscape?: boolean; } export interface InjectableMetadata extends InjectableDefinition { properties?: ReflectMetadataType[]; constructorArgs?: ReflectMetadataType[]; } export interface ReflectMetadataType { id: Identifier; scope?: ScopeEnum; index?: number; defaultValue?: boolean; noThrow?: boolean; propertyName?: string | symbol; handler?: string | symbol; lazy?: boolean; scopeEscape?: boolean; } export interface ContainerType { get(id: Identifier, options?: { noThrow?: boolean; defaultValue?: any; }): T; set(options: Partial): this; getDefinition(id: Identifier): InjectableMetadata | undefined; getInjectableByTag(tag: string): any[]; getByTag(tag: string): any[]; registerHandler(name: string | symbol, handler: HandlerFunction): void; getHandler(name: string | symbol): HandlerFunction | undefined; hasValue(options: Partial): boolean; } /** * A function that is used to handle a property * last parameter is the instance of the Container */ export type HandlerFunction = CallableFunction;