typedi
Version:
Dependency injection for TypeScript.
16 lines (15 loc) • 990 B
TypeScript
import { Constructable } from '../types/constructable.type';
import { ServiceIdentifier } from '../types/service-identifier.type';
/**
* Helper function used in inject decorators to resolve the received identifier to
* an eager type when possible or to a lazy type when cyclic dependencies are possibly involved.
*
* @param typeOrIdentifier a service identifier or a function returning a type acting as service identifier or nothing
* @param target the class definition of the target of the decorator
* @param propertyName the name of the property in case of a PropertyDecorator
* @param index the index of the parameter in the constructor in case of ParameterDecorator
*/
export declare function resolveToTypeWrapper(typeOrIdentifier: ((type?: never) => Constructable<unknown>) | ServiceIdentifier<unknown> | undefined, target: Object, propertyName: string | Symbol, index?: number): {
eagerType: ServiceIdentifier | null;
lazyType: (type?: never) => ServiceIdentifier;
};