Type alias IsArrayIncludesTypeof<Arr, T>

IsArrayIncludesTypeof<Arr, T>: IfExtends<Arr, T[], true, false>

Type Parameters

  • Arr
  • T

Returns

true if Arr is an array that includes elements of type T, otherwise false. An array of elements of type T is defined as Arr being a subtype of T[].

Example

IsArrayOf<number[], number>; // true
IsArrayOf<string[], number>; // false
IsArrayOf<number[], string>; // false
IsArrayOf<(number | string)[], number>; // false
IsArrayIncludeTypeof<Record<string, number>[], number> // false
IsArrayIncludeTypeof<string[], null | boolean> // false
ArrayIncludeTypeof<string[], string | boolean> // true
IsArrayIncludeTypeof<Record<string, number>[], Record<symbol, boolean>> // true,

See

If you want more type narrowing use IsArrayOf<Arr,T>