devtypes
    Preparing search index...

    Type Alias ListLike<T, I>

    ListLike:
        | T[]
        | ReadonlyArray<T>
        | Record<I, T>
        | Set<T>
        | ReadonlySet<T>
        | Map<I, T>
        | ReadonlyMap<I, T>
        | Iterable<T>

    List-like structures: arrays, records, sets, maps and iterables. This union is useful when an API accepts any iterable/collection of values.

    • Includes mutable and readonly arrays
    • Includes Record keyed collections
    • Includes Set and Map variants

    Type Parameters

    • T = any
    • I extends string | number = string | number
    type MyList = ListLike<number>;
    // number[] | ReadonlyArray<number> | ... | Iterable<number>