TYPESCRIPTChapter 1 · TS Basics
Typed Arrays and Tuples
Define arrays using type[]. For fixed-length arrays with specific types at exact index positions, use Tuples (e.g. [string, number]).
Worked example
How it reads
- number[] declares an array containing only numbers
- [number, number] restricts coordinates to a fixed length of 2 numbers

Cloud tip: Tuples are highly useful for return values like coordinates or key-value pairs.


