function isInstanceOf<T>(klass): (x) => x is T
Since instanceof
should generally be avoided, this function should generally be avoided as well.
A valid use case is for native types, like Uint8Array.
Type parameters
Type parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
klass | AbstractConstructor <T > |
Returns
Function
Parameters
Parameter | Type |
---|---|
x | unknown |
Returns
x is T