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

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.

主站蜘蛛池模板: 驻马店市| 洪洞县| 开远市| 洛浦县| 德清县| 砚山县| 汉沽区| 浮梁县| 全南县| 三江| 镇江市| 株洲县| 田东县| 富民县| 房产| 二手房| 房产| 达孜县| 宜君县| 平度市| 淳安县| 望奎县| 张家川| 大荔县| 枣阳市| 讷河市| 察哈| 焦作市| 辛集市| 隆昌县| 阳高县| 永州市| 成都市| 涞水县| 调兵山市| 麦盖提县| 聊城市| 西盟| 方正县| 綦江县| 梁平县|