Tuple For Type and Length Arrays
In this lesson, we will discuss tuples and how TypeScript differentiates them from arrays.
We'll cover the following...
Tuple syntax
The tuple type is an array of defined elements. To declare a tuple, you use square brackets, as in line 1, but instead of specifying a value, you use a type.
TypeScript 3.3.4
let numberTuple: [number, number, number];
A tuple can handle many different types. The tuple uses the same syntax as other types.
TypeScript 3.3.4
let myTupleWithTwoTypes: [number, string];
There is no difference between the declaration of a variable ...