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 Export | Alias Names |
|---|---|
isValidArray | isArrayWithLength |
Notes
- More efficient than separate
isArrayandlengthchecks - Returns
falsefor sparse arrays with length but no elements - Preserves type information through generics
Last updated: Wed, May 27, 2026 05:21:04AM (UTC)
