import { DependencyIdentifier } from './dependencyIdentifier'; import { Ctor, DependencyItem } from './dependencyItem'; import { IDisposable } from './dispose'; import { Quantity } from './types'; import { RediError } from './error'; export type DependencyPair = [DependencyIdentifier, DependencyItem]; export type DependencyClass = [Ctor]; export type Dependency = DependencyPair | DependencyClass; export type DependencyWithInstance = [ Ctor | DependencyIdentifier, T ]; export type DependencyOrInstance = Dependency | DependencyWithInstance; export declare function isBareClassDependency(thing: Dependency): thing is DependencyClass; export declare function pushResolvingStack(id: DependencyIdentifier): void; export declare function popupResolvingStack(): void; export declare function clearResolvingStack(): void; export declare class DependencyNotFoundForModuleError extends RediError { constructor(toInstantiate: Ctor | DependencyIdentifier, id: DependencyIdentifier, index: number); } export declare class DependencyNotFoundError extends RediError { constructor(id: DependencyIdentifier); } /** * Store unresolved dependencies in an injector. * * @internal */ export declare class DependencyCollection implements IDisposable { private readonly dependencyMap; constructor(dependencies: Dependency[]); add(ctor: Ctor): void; add(id: DependencyIdentifier, val: DependencyItem): void; delete(id: DependencyIdentifier): void; get(id: DependencyIdentifier): DependencyItem; get(id: DependencyIdentifier, quantity: Quantity.REQUIRED): DependencyItem; get(id: DependencyIdentifier, quantity: Quantity.MANY): DependencyItem[]; get(id: DependencyIdentifier, quantity: Quantity.OPTIONAL): DependencyItem | null; get(id: DependencyIdentifier, quantity: Quantity): DependencyItem | DependencyItem[] | null; has(id: DependencyIdentifier): boolean; append(dependencies: Dependency[]): void; dispose(): void; /** * normalize dependencies to `DependencyItem` */ private normalizeDependencies; } /** * Store resolved dependencies. * * @internal */ export declare class ResolvedDependencyCollection implements IDisposable { private readonly resolvedDependencies; add(id: DependencyIdentifier, val: T | null): void; has(id: DependencyIdentifier): boolean; delete(id: DependencyIdentifier): void; get(id: DependencyIdentifier): T; get(id: DependencyIdentifier, quantity: Quantity.OPTIONAL): T | null; get(id: DependencyIdentifier, quantity: Quantity.REQUIRED): T; get(id: DependencyIdentifier, quantity: Quantity.MANY): T[]; get(id: DependencyIdentifier, quantity: Quantity): T[] | T | null; dispose(): void; }