O'Reilly logo

Learning Angular for .NET Developers by Rajesh Gunasundaram

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 shown:

interface CutomerNameArray {   [index: number]: string; }  let customerNameList: CutomerNameArray; customerNameList = ["Rajesh", "Gunasundaram"]; 

TypeScript supports two types of index, namely number, and string. This array type interface also enforces that the return type of the array should match the declaration.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required