UNPKG

ts-bakery

Version:

Baked dependency injection for Typescript.

29 lines (28 loc) 1.04 kB
import GenericConstructor from './ConstructorReference'; import IDependencyRegistrationBuilder from './IDepedencyResolverModule'; import IDependencyRegistration from './IDependencyRegistration'; export default class DependencyRegistrationBuilder<T> implements IDependencyRegistrationBuilder { private _isSingle; private _isLazy; private _restrictions; private _name; private _constructor; constructor(cstr: GenericConstructor<T>); build(): IDependencyRegistration; /** * Will only ever create one single instance of this object. * @returns */ asSingle(): DependencyRegistrationBuilder<T>; /** * Will restrict injection of this type only to types within restriction. * @param restrictions * @returns */ restrictTo(...restrictions: GenericConstructor<unknown>[]): DependencyRegistrationBuilder<T>; /** * Will create an instance immediately after its dependecies have been resolved. * @returns */ nonLazy(): DependencyRegistrationBuilder<T>; }