Type Helpers
Utility functions for working with type operations.
Functions
Section titled “Functions”| Function | Description |
|---|---|
DeepPartial | Recursively makes all properties of T optional, including nested objects and array elements. |
DeepWritable | Recursively removes readonly from all properties of T, including nested objects, array elements, and tuple positions. |
isArray | Checks if a value is an array. |
isArrayBuffer | Checks if a value is an ArrayBuffer instance. |
isArrayLike | Checks if a value is array-like: has a non-negative integer length property. |
isAsyncFunction | Checks if a value is an async function. |
isAsyncGenerator | Checks if a value is an async generator object (the result of calling an async function*). |
isAsyncGeneratorFunction | Checks if a value is an async generator function (an async function* declaration or expression). |
isAsyncIterable | Checks if a value implements the async iterable protocol. |
isBigInt | Checks if a value is a bigint. |
isBlob | Checks if a value is a Blob instance. |
isBoolean | Checks if a value is a boolean. |
isDate | Checks if a value is a Date instance. |
isDefined | Checks if a value is defined (not undefined nor null). |
isDirectInstanceOf | native JS value.constructor === Foo (ES1) |
isEmpty | Checks if a value is empty. |
isError | Checks if a value is an Error instance. |
isFalsy | Checks if a value is falsy (false, null, undefined, 0, "", NaN). |
isFinite / isFiniteNumber | native JS Number.isFinite(value) (ES2015) |
isFormData | Checks if a value is a FormData instance. |
isFunction | Checks if a value is a function. |
isGenerator | Checks if a value is a generator object (the result of calling a function*). |
isGeneratorFunction | Checks if a value is a generator function (a function* declaration or expression). |
isHtmlElement / isUrlInstance / isUrlSearchParams | native JS value instanceof HTMLElement / URL / URLSearchParams (Web API) |
isInfinite | native JS value === Infinity || value === -Infinity / !Number.isFinite(value) && !Number.isNaN(value) (ES2015) |
isInteger | native JS Number.isInteger(value) (ES2015) |
isIterable | Checks if a value is iterable (has a Symbol.iterator method). |
isMap | Checks if a value is a Map instance. |
isNaN | native JS Number.isNaN(value) (ES2015) |
isNull | Checks if a value is null. |
isNullish | Checks if a value is null or undefined (nullish). |
isNumber | Checks if a value is a number. |
isPlainObject | Checks if a value is a plain object. |
isPrimitive | Checks if a value is a JavaScript primitive. |
isPromise | Checks if a value is a Promise or a thenable. |
isPromiseLike | Checks if a value is a thenable (has a .then() method). |
isPropertyKey | Checks if a value is a valid property key: string, number, or symbol. |
isRegExp | Checks if a value is a RegExp instance. |
isSafeInteger | native JS Number.isSafeInteger(value) (ES2015) |
isSet (Set data structure) | native JS value instanceof Set (ES2015) |
isSpecialObject | Determines if a value is a special object that should not have its properties compared deeply. |
isString | Checks if a value is a string. |
isSymbol | Checks if a value is a symbol. |
isTemporalDuration | Checks if a value is a Temporal.Duration. |
isTemporalInstant | Checks if a value is a Temporal.Instant. |
isTemporalPlainDate | Checks if a value is a Temporal.PlainDate. |
isTemporalPlainDateTime | Checks if a value is a Temporal.PlainDateTime. |
isTemporalPlainTime | Checks if a value is a Temporal.PlainTime. |
isTemporalZonedDateTime | Checks if a value is a Temporal.ZonedDateTime. |
isTimestamp | Checks if a value is a valid timestamp (milliseconds or Unix seconds). |
isTruthy | Checks if a value is truthy (not false, null, undefined, 0, "", or NaN). |
isUndefined | Checks if a value is undefined. |
isValidRegex | Checks if a string is a valid regex pattern. |
isWeakMap / isWeakSet / isWeakRef | native JS value instanceof WeakMap / WeakSet / WeakRef (ES2015 / ES2021) |
TypedArrays (isInt8Array, isFloat32Array, ...) | native JS value instanceof Int8Array / Float32Array / ... (ES2015) |