官术网_书友最值得收藏!

Array type interfaces

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.

主站蜘蛛池模板: 界首市| 阿克陶县| 饶河县| 隆尧县| 云安县| 清水县| 深水埗区| 景谷| 河间市| 酉阳| 鄯善县| 庆阳市| 麦盖提县| 辉县市| 衡阳市| 南皮县| 烟台市| 云安县| 恩施市| 水富县| 收藏| 望江县| 呼伦贝尔市| 亚东县| 尼勒克县| 巴彦淖尔市| 南京市| 公主岭市| 美姑县| 灌阳县| 留坝县| 鹤庆县| 泸州市| 临夏市| 砚山县| 遂溪县| 三台县| 胶州市| 赤峰市| 延川县| 井研县|