UNPKG

ts-ioc-container

Version:
17 lines (16 loc) 929 B
import { type DependencyKey, type IContainer } from './container/IContainer'; import { type MapFn } from './utils'; import { type IRegistration, type ScopePredicate } from './registration/IRegistration'; import { type IProvider } from './provider/IProvider'; import { type IInjectFnResolver } from './injector/IInjector'; import { type ProviderPipe } from './provider/ProviderPipe'; export type DepKey<T> = IInjectFnResolver<T> & { key: DependencyKey; asKey: (registration: IRegistration<T>) => IRegistration<T>; register: (fn: (s: IContainer, ...args: unknown[]) => T) => IRegistration<T>; pipe(...values: Array<MapFn<IProvider<T>> | ProviderPipe>): DepKey<T>; when(value: ScopePredicate): DepKey<T>; asAlias: (registration: IRegistration<T>) => IRegistration<T>; }; export declare const isDepKey: <T>(key: unknown) => key is DepKey<T>; export declare const depKey: <T>(key: DependencyKey) => DepKey<T>;