isSubclassOrLooksLike
Available since v0.9
Determine if target class is a subclass of given superclass, or if it looks like given blueprint.
It accepts the following arguments:
target: object
- The target.superclass: ConstructorOrAbstractConstructor
- The superclass.blueprint: ClassBlueprint
- Class Blueprint (SeeclassLooksLike
).
import { isSubclassOrLooksLike } from '@aedart/support/reflections';
class A {
foo() {}
}
class B extends A {}
class C {
foo() {}
}
isSubclassOrLooksLike(B, A, { members: [] }); // true
isSubclassOrLooksLike(C, A, { members: [] }); // false
isSubclassOrLooksLike(C, A, { members: [ 'foo' ] }); // true
See isSubclass()
and classLooksLike()
for additional details.