UNPKG

@inversifyjs/core

Version:

InversifyJs core package

19 lines 692 B
import { getBaseType } from '@inversifyjs/prototype-utils'; import { injectFrom } from './injectFrom.js'; export function injectFromHierarchy(options) { // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type return (target) => { const chain = []; let current = getBaseType(target); while (current !== undefined && current !== Object) { const ancestor = current; chain.push(ancestor); current = getBaseType(ancestor); } chain.reverse(); for (const type of chain) { injectFrom({ ...options, type })(target); } }; } //# sourceMappingURL=injectFromHierarchy.js.map