Type Alias Entries<A>

Entries: IsTuple<
    A,
    {
        $else: A extends (infer T)[] ? [number, T][] : never;
        $then: ArrayPlus.Entries.Device<A, []>;
    },
>

Returns an array of key-value pairs for every entry in the array or tuple.

Note that this is not the same as Array.entries(A), which returns an iterable interator.

Type Parameters

  • A extends readonly unknown[]
ArrayPlus.Entries<Array<string | number>> // Array<[number, string | number]>
ArrayPlus.Entries<[1, 2, 3]> // [[0, 1], [1, 2], [2, 3]]