12345678910111213141516171819202122232425262728293031323334353637 |
- /**
- * Type for what object is instances of. Also applicable to "Constructor of T" as Types/Classes/Constructors are interchangable in TS.
- */
- export interface Type<T> {
- new(...args: any[]): T;
- }
-
- export type Constructor<T> = Function & { prototype: T }
-
- /**
- * Generic `ClassDecorator` type
- */
- export type GenericClassDecorator<T> = (target: T) => void;
-
- export type SingletonDefinition = {
- initializationPriority?: number //Priority of initializing this object after creation, lower value means higher priority; default: 0
- ctor: Type<any> //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)
- }
- }
|