You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Internals.ts 970B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Type for what object is instances of. Also applicable to "Constructor of T" as Types/Classes/Constructors are interchangable in TS.
  3. */
  4. export interface Type<T> {
  5. new(...args: any[]): T;
  6. }
  7. export type Constructor<T> = Function & { prototype: T }
  8. /**
  9. * Generic `ClassDecorator` type
  10. */
  11. export type GenericClassDecorator<T> = (target: T) => void;
  12. export type SingletonDefinition = {
  13. initializationPriority?: number //Priority of initializing this object after creation, lower value means higher priority; default: 0
  14. ctor: Type<any> //Object constructor to make singleton from
  15. }
  16. export class NamedError extends Error{
  17. constructor(message: string){
  18. super(message)
  19. this.name = this.constructor.name
  20. }
  21. }
  22. export class InjectionError extends NamedError{
  23. constructor(message: string){
  24. super(message)
  25. }
  26. }
  27. export class InjectionResolutionError extends InjectionError{
  28. constructor(message: string){
  29. super(message)
  30. }
  31. }