UNPKG

@baizey/dependency-injection

Version:
51 lines (50 loc) 2.17 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.CircularDependencyError = void 0; var types_1 = require("./types"); var CircularDependencyError = /** @class */ (function (_super) { __extends(CircularDependencyError, _super); function CircularDependencyError(lifetime, provided) { var _this = _super.call(this, "'".concat(lifetime.toString(), "' has circular dependency in the chain: '").concat(provided .map(function (e) { return e.toString(); }) .join(' > '), "'. Two dependencies cannot depend on each other no matter how long the chain is between them")) || this; Object.defineProperty(_this, "type", { enumerable: true, configurable: true, writable: true, value: types_1.DependencyErrorType.Circular }); Object.defineProperty(_this, "lifetime", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(_this, "provided", { enumerable: true, configurable: true, writable: true, value: void 0 }); _this.lifetime = lifetime; _this.provided = provided; return _this; } return CircularDependencyError; }(Error)); exports.CircularDependencyError = CircularDependencyError;