In JavaScript, a tuple is effectively an immutable array of primitives with known length.You can use a plain JavaScript array as a tuple to handle cases like returning multiple values as follows.In TypeScript
TypeScript supports a tuple type: [number, number, number] is a tuple of 3 numbers.Attempting to access the 4th element of a tuple of length 3 throws a compiler error as follows.
TypeScript supports a tuple type: [number, number, number] is a tuple of 3 numbers.Attempting to access the 4th element of a tuple of length 3 throws a compiler error as follows.
[
Collection
]
[
|
...
]