July 2017
Intermediate to advanced
454 pages
10h 1m
English
We can also define an interface for array types. We can specify the data type for the index array and the data type to the array item as follows:
interface CutomerNameArray {
[index: number]: string;
}
var customerNameList: CutomerNameArray;
customerNameList = ["Rajesh", "Gunasundaram"];
TypeScript supports two types of index: number and string. This array type interface also stipulates that the return type of the array should match the declaration.
Read now
Unlock full access