UNPKG

ts-ioc-container

Version:

Fast, lightweight TypeScript dependency injection container with a clean API, scoped lifecycles, decorators, tokens, hooks, lazy injection, customizable providers, and no global container objects.

31 lines (30 loc) 1.52 kB
import { type DependencyKey, type IContainer, type IContainerModule, type ResolveManyOptions, type ResolveOneOptions, type Tag } from './IContainer'; import { type IProvider } from '../provider/IProvider'; import { type IRegistration } from '../registration/IRegistration'; import { OnDisposeHook } from '../hooks/onDispose'; import { OnConstructHook } from '../hooks/onConstruct'; import { type constructor, type Instance } from '../utils/basic'; export declare class EmptyContainer implements IContainer { get isDisposed(): boolean; addInstance(instance: Instance): void; getParent(): undefined; getScopes(): never[]; getScopeByInstanceOrFail(instance: object): IContainer; getInstances(): never[]; hasInstance(instance: object): boolean; createScope(): IContainer; dispose(): void; register(key: DependencyKey, value: IProvider): this; hasTag(tag: Tag): boolean; addTags(...tags: Tag[]): void; getRegistrations(): never[]; hasRegistration(key: DependencyKey): boolean; removeScope(): void; useModule(module: IContainerModule): this; addRegistration(registration: IRegistration): this; resolve<T>(key: constructor<T> | DependencyKey, options?: ResolveOneOptions): T; resolveByAlias<T>(alias: DependencyKey, options?: ResolveManyOptions): T[]; resolveOneByAlias<T>(alias: DependencyKey, options?: ResolveOneOptions): T; addOnDisposeHook(...hooks: OnDisposeHook[]): this; addOnConstructHook(...hooks: OnConstructHook[]): this; }