TypeScript · Types and shapes

Tuple

A fixed-length array where each position has a type. Optional and rest elements are allowed.

Syntax
[string, number]

Example

Example
type Pair = [string, number];
const entry: Pair = ["css", 26];

More in this group

any Array types enums Function type Interface Literal type never null and undefined

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course