Skip to content

Function: isCollection()

isCollection<T>(value): value is Collection<T>

Type guard for a Collection: an Array, Set, or Map. Narrows value so its element/value type is treated as T.

T = unknown

Element (or Map value) type asserted for the collection.

unknown

Value to test.

value is Collection<T>

true (narrowing value to Collection<T>) for a built-in array/set/map.