Skip to main content
D
TypeScript
TypeScript Tuples

TypeScript Tuples

Tuples are arrays with a fixed length and strict types.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

A standard array in TypeScript can hold as many items as you want. A Tuple is a strict array where you define exactly how many items it holds, and exactly what type of data belongs in each specific slot.

Example

Example
1/* this creates a tuple */
2let myTuple: [number, string, boolean];
3
4// This works perfectly
5myTuple = [1, "Alice", true];
6
7// myTuple = ["Alice", 1, true]; // Error: Wrong order!

Key Points

  • Define a Tuple using square brackets `[type1, type2]`.
  • The order of the data must match the definition exactly.
  • They are commonly used in React Hooks (like `useState`).
  • You cannot add extra items beyond the defined length.

Up Next

Continue your journey with the next topic.

Go to TS Type Assertions