getAllParentsOfClass
Available since v0.9
Returns all parents of target class. It accepts the following arguments:
target: ConstructorOrAbstractConstructor
- The target class.includeTarget: boolean = false
- (optional) Iftrue
, then given target is included in the output as the first element.
import { getAllParentsOfClass } from '@aedart/support/reflections';
class A {}
class B extends A {}
class C extends B {}
getAllParentsOfClass(C); // [ B, A ]
getAllParentsOfClass(C, true); // [ C, B, A ]
See also getParentOfClass()
.