UNPKG

node-apparatus

Version:

A mix of common components needed for awesome node experience

27 lines (26 loc) 1.57 kB
/** * InjectableConstructor is a class that is used to create instances of classes.(this helps with dependency injection & mocking). */ export declare class InjectableConstructor { /** * Creates an instance of a class with a constructor. * @param typeConstructor The class constructor * @param constructorArguments The arguments to pass to the constructor(optional) * @returns The instance of the class */ createInstance<InstanceType>(typeConstructor: new (...constructorArguments: any[]) => InstanceType, constructorArguments?: any[]): InstanceType; /** * Creates an instance of a class without a constructor asynchronously. * @param typeConstructorFunction The class constructor ASYNC function. * @param constructorFunctionArguments the arguments to pass to the constructor(optional) * @returns The instance of the class */ createAsyncInstanceWithoutConstructor<InstanceType>(typeConstructorFunction: (...constructorFunctionArguments: any[]) => Promise<InstanceType>, constructorFunctionArguments?: any[]): Promise<InstanceType>; /** * Creates an instance of a class without a constructor. * @param typeConstructorFunction The class constructor function. * @param constructorFunctionArguments the arguments to pass to the constructor(optional) * @returns The instance of the class */ createInstanceWithoutConstructor<InstanceType>(typeConstructorFunction: (...constructorFunctionArguments: any[]) => InstanceType, constructorFunctionArguments?: any[]): InstanceType; }