sahara
Version:
An inversion-of-control container for managing dependencies. Supports constructor, property and method injection
29 lines (28 loc) • 1.36 kB
TypeScript
import { Container } from './container';
import { Constructor } from './types';
export interface Injection<TType = unknown> {
inject(object: TType, container: Container): Promise<void>;
injectSync(object: TType, container: Container): void;
}
export declare class PropertyValueInjection<TType = unknown, TValue = unknown> implements Injection<TType> {
private readonly propertyName;
private readonly value;
constructor(propertyName: keyof TType & string, value: TValue);
inject(object: TType, container: Container): Promise<void>;
injectSync(object: TType, container: Container): void;
}
export declare class PropertyInjection<TType = unknown> implements Injection<TType> {
private readonly propertyName;
private readonly valueKey;
constructor(propertyName: keyof TType & string, valueKey: Constructor<TType> | string);
inject(object: TType, container: Container): Promise<void>;
injectSync(object: TType, container: Container): void;
}
export declare class MethodInjection<TType = unknown> implements Injection<TType> {
private readonly methodName;
private readonly args?;
constructor(methodName: keyof TType & string, args?: any[] | null | undefined);
private createError;
inject(object: TType, container: Container): Promise<void>;
injectSync(object: TType, container: Container): void;
}