Arrays and Tuples
Part of the TypeScript course
A single value is rarely enough. You have a list of temperatures, a list of names, a list of prices. And the moment you have a list, a new kind of mistake becomes available: the list that was supposed to hold numbers has a string in it, somewhere, put there by a function three files away, and you find out when an arithmetic operation quietly produces nonsense.
TypeScript's answer is to let you say what a list holds. Not just "this is a list", but "this is a list of numbers", and then it checks every value that goes in and every value that comes out. ...
Want to learn TypeScript Arrays and Tuples in a real environment?
Click below, get a fresh Linux box with TypeScript ready to go, and work through Arrays and Tuples hands-on with an AI tutor that knows your code.
Start this lessonArrays and TuplesWhat you'll learn
- Array types
- Readonly arrays
- Tuple types
- Fixed-length tuples
- Named tuple elements
Read this lesson in your language
All lessons in this course
18 lessons- 1Hello, TypeScript20 min
- 2Type Basics25 min
- 3Arrays and Tuples25 min
- 4Object Types and Interfaces25 min
- 5Functions25 min
- 6Union and Literal Types25 min
- 7Type Narrowing30 min
- 8Type Aliases vs Interfaces20 min
- 9Optional, Readonly, and Nullable25 min
- 10Enums20 min
- 11Generics30 min
- 12Classes25 min
- 13Inheritance and Abstract Classes25 min
- 14Modules25 min
- 15Utility Types30 min
- 16Mapped and Conditional Types30 min
- 17Declaration Files and Libraries25 min
- 18tsconfig and the Compiler30 min
