Toolbox-XToolbox-X
GuardsArray Guards

Check Valid Array

Checks if a value is both an array and contains at least one element.

isValidArray

Checks if a value is both an array and contains at least one element. Combines array detection with length check in a single operation.

Signature

function isValidArray<T>(value: unknown): value is Array<T>

Examples

playground.ts

Aliases

Main ExportAlias Names
isValidArrayisArrayWithLength

Notes

  • More efficient than separate isArray and length checks
  • Returns false for sparse arrays with length but no elements
  • Preserves type information through generics

Last updated: Wed, May 27, 2026 05:21:04AM (UTC)

On this page