asInstanceOf Function

Cast obj to an instance of class T, or return undefined if obj is not an instance of class T.

asInstanceOf<T>(obj: any, constructor: Constructor<T>): T | undefined

@see isInstanceOf to query whether obj is of class T.

Parameter Type Description
obj any  
constructor Constructor<T>  

Returns - T | undefined

Defined in

Last Updated: 17 December, 2024