Tuple For Type and Length Arrays

In this lesson, we will discuss tuples and how TypeScript differentiates them from arrays.

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.

Get hands-on with 1200+ tech skills courses.