Skip to content

Type Helpers

Utility functions for working with type operations.

FunctionDescription
DeepPartialRecursively makes all properties of T optional, including nested objects and array elements.
DeepWritableRecursively removes readonly from all properties of T, including nested objects, array elements, and tuple positions.
isArrayChecks if a value is an array.
isArrayBufferChecks if a value is an ArrayBuffer instance.
isArrayLikeChecks if a value is array-like: has a non-negative integer length property.
isAsyncFunctionChecks if a value is an async function.
isAsyncGeneratorChecks if a value is an async generator object (the result of calling an async function*).
isAsyncGeneratorFunctionChecks if a value is an async generator function (an async function* declaration or expression).
isAsyncIterableChecks if a value implements the async iterable protocol.
isBigIntChecks if a value is a bigint.
isBlobChecks if a value is a Blob instance.
isBooleanChecks if a value is a boolean.
isDateChecks if a value is a Date instance.
isDefinedChecks if a value is defined (not undefined nor null).
isDirectInstanceOfnative JS value.constructor === Foo (ES1)
isEmptyChecks if a value is empty.
isErrorChecks if a value is an Error instance.
isFalsyChecks if a value is falsy (false, null, undefined, 0, "", NaN).
isFinite / isFiniteNumbernative JS Number.isFinite(value) (ES2015)
isFormDataChecks if a value is a FormData instance.
isFunctionChecks if a value is a function.
isGeneratorChecks if a value is a generator object (the result of calling a function*).
isGeneratorFunctionChecks if a value is a generator function (a function* declaration or expression).
isHtmlElement / isUrlInstance / isUrlSearchParamsnative JS value instanceof HTMLElement / URL / URLSearchParams (Web API)
isInfinitenative JS value === Infinity || value === -Infinity / !Number.isFinite(value) && !Number.isNaN(value) (ES2015)
isIntegernative JS Number.isInteger(value) (ES2015)
isIterableChecks if a value is iterable (has a Symbol.iterator method).
isMapChecks if a value is a Map instance.
isNaNnative JS Number.isNaN(value) (ES2015)
isNullChecks if a value is null.
isNullishChecks if a value is null or undefined (nullish).
isNumberChecks if a value is a number.
isPlainObjectChecks if a value is a plain object.
isPrimitiveChecks if a value is a JavaScript primitive.
isPromiseChecks if a value is a Promise or a thenable.
isPromiseLikeChecks if a value is a thenable (has a .then() method).
isPropertyKeyChecks if a value is a valid property key: string, number, or symbol.
isRegExpChecks if a value is a RegExp instance.
isSafeIntegernative JS Number.isSafeInteger(value) (ES2015)
isSet (Set data structure)native JS value instanceof Set (ES2015)
isSpecialObjectDetermines if a value is a special object that should not have its properties compared deeply.
isStringChecks if a value is a string.
isSymbolChecks if a value is a symbol.
isTemporalDurationChecks if a value is a Temporal.Duration.
isTemporalInstantChecks if a value is a Temporal.Instant.
isTemporalPlainDateChecks if a value is a Temporal.PlainDate.
isTemporalPlainDateTimeChecks if a value is a Temporal.PlainDateTime.
isTemporalPlainTimeChecks if a value is a Temporal.PlainTime.
isTemporalZonedDateTimeChecks if a value is a Temporal.ZonedDateTime.
isTimestampChecks if a value is a valid timestamp (milliseconds or Unix seconds).
isTruthyChecks if a value is truthy (not false, null, undefined, 0, "", or NaN).
isUndefinedChecks if a value is undefined.
isValidRegexChecks if a string is a valid regex pattern.
isWeakMap / isWeakSet / isWeakRefnative JS value instanceof WeakMap / WeakSet / WeakRef (ES2015 / ES2021)
TypedArrays (isInt8Array, isFloat32Array, ...)native JS value instanceof Int8Array / Float32Array / ... (ES2015)