TypeIsList
TypeIsList is a predicate used in type systems, reflection utilities, and code-generation tools to determine whether a given type represents a list-like container. In practice, TypeIsList(T) is true for types that behave as sequences or collections whose elements can be accessed by index or iteration, and false for scalar types, maps, or non-sequence containers in many definitions. The exact scope of what counts as a list varies by language and library: some definitions include arrays and generic list types, while others extend to any type that implements a common sequence interface. Strings are often treated as non-lists to avoid conflating textual data with list-like structures.
Implementation and usage vary by language. In statically typed languages with generics, TypeIsList can be a
Examples in common languages illustrate the idea. In TypeScript, a simple form is type TypeIsList<T> = T
Limitations include ambiguity across collection types, differences between arrays, lists, and other iterables, and potential erasure
See also: IsIterable, IsSequence, List, Array, Collection, Type predicates.