This blog post will look at Indexable Types. It is part of the Introduction to Advanced Types in TypeScript series.
In JavaScript, there are values, from which additional values can be retrieved via an index. A natural example of such a value is an Array: For example, given the following array:
const primaryColors = ["red", "green", "blue"]
The value primaryColors is an array value, and its individual content can be accessed by providing an index of type number:
console.log(primaryColors[0])
console.log(primaryColors[1])
console.log(primaryColors[2])