UNPKG

async-injection

Version:

A robust lightweight dependency injection library for TypeScript.

21 lines 566 B
/** * Allow for implicit typing of constants and interfaces. * Inspired by Angular and some colleges at work. */ export class InjectionToken { constructor(id) { this.id = id; } get description() { return this.toString(); } toString() { // noinspection SuspiciousTypeOfGuard if (typeof this.id === 'symbol') { const desc = this.id.description; return desc !== undefined ? desc : this.id.toString(); } return this.id.toString(); } } //# sourceMappingURL=injector.js.map