Function superClassOf

  • Detects a super class of the given class optionally satisfying the given criteria.

    Traverses all class ancestors until reaches the one satisfying the given criteria, or stops when there is no more ancestors.

    Parameters

    • type: AbstractClass<object>

      The class constructor to find super class of.

    • satisfying: ((this, type) => boolean) = ...

      The criteria of super class matching. It is a function accepting a super class constructor as the only parameter and returning true if the given super class matches, or false otherwise. Always returns true by default.

        • (this, type): boolean
        • Parameters

          Returns boolean

    Returns AbstractClass | undefined

    A super class satisfying the given criteria, or undefined if there is no such super class, or there is no super class at all (e.g. when Object is passed in).

Generated using TypeDoc