UNPKG

ts-ioc-container

Version:
24 lines (23 loc) 1.19 kB
import type { DependencyKey, IContainer } from '../container/IContainer'; import type { constructor, MapFn } from '../utils'; import type { IProvider, ResolveDependency } from '../provider/IProvider'; import type { IRegistration, ScopePredicate } from './IRegistration'; import type { ProviderPipe } from '../provider/ProviderPipe'; export declare class Registration<T = any> implements IRegistration<T> { private createProvider; private key?; private scopePredicates; static fromClass<T>(Target: constructor<T>): IRegistration<any>; static fromValue<T>(value: T): IRegistration<any> | Registration<T>; static fromFn<T>(fn: ResolveDependency<T>): Registration<T>; static fromKey<T>(key: DependencyKey): Registration<T>; private mappers; private aliases; constructor(createProvider: () => IProvider<T>, key?: DependencyKey | undefined, scopePredicates?: ScopePredicate[]); bindToKey(key: DependencyKey): this; bindToAlias(alias: DependencyKey): this; pipe(...mappers: (MapFn<IProvider<T>> | ProviderPipe<T>)[]): this; when(...predicates: ScopePredicate[]): this; private matchScope; applyTo(container: IContainer): void; }