guardInstance()
Last updated
Was this helpful?
Last updated
Was this helpful?
guardInstance()
Guards the value to be an instance of the given .
Code on .
Obj
extends
object
A generic type variable Obj
constrained by indicates captured type of the given via the and the parameter of the provided function type.
Payload
extends
object
=
object
value: Obj
constructor: Constructor<Obj>
callback?: ResultCallback<Obj, { ctor: typeof constructor } & Payload>
payload?: Payload
value is Obj
The Payload
generic type variable constrained by indicates the type of optional parameter of the supplied function and optional parameter of the function from which it captures its value.
An of a generic type variable to guard and be compared with an instance of a given .
A or that specifies the type of the .
The optional callback of type with parameters, the that has been checked, the of this check, and of generic type variable with optional properties from the provided , to handle them before the return. By default, it uses function.
The parameter of the function consists of the ctor
property under which is set given , and it can't be overwritten by the given parameter of the core function.
An optional of the generic type variable is assigned to the of the given function.
The return type is a as the result of its statement indicating the is a generic type variable by default of the type captured from the provided .
The return value is a indicating whether the is an instance of a given .