Skip to content

is

The is() method checks whether a value is an array (type guard).

Interactive example

Syntax

typescript
function is<
	GenericInput extends unknown
>(
	input: GenericInput
): input is GenericInput extends any[] ? GenericInput : never

Parameters

  • input: The value to test.

Return value

true if the value is an array, false otherwise. Narrows the type to an array when true.

See also

  • from - Creates an array from an iterable

Sources

Released under the MIT license.