Tuple
Helper functions that have to do with TypeScript tuples.
Functions
Section titled “Functions”tupleEntries()
Section titled “tupleEntries()”function tupleEntries<T>(tuple): Generator<TupleEntry<T>>;Defined in: functions/tuple.ts:21
Helper function to get the entries (i.e., indexes and values) of a tuple in a type-safe way.
This is useful because the vanilla Array.entries method will always have the
keys be of type number.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends readonly unknown[] |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
tuple |
T |
Returns
Section titled “Returns”Generator<TupleEntry<T>>
tupleKeys()
Section titled “tupleKeys()”function tupleKeys<T>(tuple): Generator<TupleKey<T>>;Defined in: functions/tuple.ts:33
Helper function to get the keys (i.e., indexes) of a tuple in a type-safe way.
This is useful because the vanilla Array.keys method will always have the keys
be of type number.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends readonly unknown[] |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
tuple |
T |
Returns
Section titled “Returns”Generator<TupleKey<T>>
