isSubclassOf Function

Check if class subclass is superclass or extends from superclass

isSubclassOf<SuperClass extends (...: any[]) => any, NonSubClass extends (...: any[]) => any, SubClass extends (..._: any[]) => InstanceType<SuperClass>>(subclass: SuperClass | NonSubClass | SubClass, superclass: SuperClass): subclass is SuperClass | SubClass

@note The constructors of all types must be public.

@returns whether subclass is a subclass of superclass

Parameter Type Description
subclass SuperClass | NonSubClass | SubClass the class that may be a subclass of superclass.
superclass SuperClass the class that may be a base class of subclass.

Returns - subclass is SuperClass | SubClass

whether subclass is a subclass of superclass

Defined in

Last Updated: 21 November, 2024