/** * Type for what object is instances of. Also applicable to "Constructor of T" as Types/Classes/Constructors are interchangable in TS. */ export interface Type { new(...args: any[]): T; } export type Constructor = Function & { prototype: T } /** * Generic `ClassDecorator` type */ export type GenericClassDecorator = (target: T) => void; export type SingletonDefinition = { initializationPriority?: number //Priority of initializing this object after creation, lower value means higher priority; default: 0 ctor: Type //Object constructor to make singleton from } export class NamedError extends Error{ constructor(message: string){ super(message) this.name = this.constructor.name } } export class InjectionError extends NamedError{ constructor(message: string){ super(message) } } export class InjectionResolutionError extends InjectionError{ constructor(message: string){ super(message) } }