Toolbox-XToolbox-X
GuardsArray Guards

Check Array of Type

Validates that all elements in an array match a specific type guard.

isArrayOfType

Validates that all elements in an array match a specific type guard. Useful for checking homogeneous collections from untyped sources.

Signature

function isArrayOfType<T>(
  value: unknown,
  typeCheck: (item: unknown) => item is T
): value is T[]

Examples

playground.ts

Use Cases

  • Validating API response arrays
  • Processing CSV/JSON data
  • Sanitizing user-provided arrays
  • Runtime validation of typed collections

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

On this page