0Pricing
TypeScript Academy · Lesson

Tuples: Fixed-Length Typed Arrays

Define tuples for structured data with known positions.

Welcome

Tuples are arrays with a fixed number of elements where each position has a specific type. They are perfect for structured data like coordinates or key-value pairs.

Defining a Tuple

A tuple type lists the type of each element in order. The length is fixed and each position must hold the declared type.
const point: [number, number] = [10, 20];
const entry: [string, number] = ['age', 25];

All lessons in this course

  1. Typed Arrays: T[] and Array
  2. Readonly Arrays and Immutable Data
  3. Tuples: Fixed-Length Typed Arrays
  4. Enums: Numeric and String Constants
← Back to TypeScript Academy