isType()
isType()
isType()const isType = <T extends Type, Payload extends object = object>(
value: any,
type: Types<T>,
callback: ResultCallback<any, Payload> = resultCallback,
payload?: Payload
): value is T =>
isStringType(type)
? {
bigint: isBigInt,
boolean: isBooleanType,
function: isFunction,
number: isNumberType,
object: isObject,
null: isNull,
string: isStringType,
symbol: isSymbol,
undefined: isUndefined,
}[type as Primitives](value, callback, payload)
: isNotNull(type)
? isInstance(value, type, callback, payload)
: false;Generic type variables
TextendsType
TextendsTypePayloadextendsobject=object
Payloadextendsobject=objectParameters
value: any
value: anytype: Types<T>
type: Types<T>callback: ResultCallback<any, Payload>
callback: ResultCallback<any, Payload>payload?: Payload
payload?: PayloadReturn type
value is T
value is TReturns
Example usage
Last updated