I'm new to Typescript. I saw the following code in one project on GitHub, What does it mean?
interface info {
[index: string]: any;
}
I'm new to Typescript. I saw the following code in one project on GitHub, What does it mean?
interface info {
[index: string]: any;
}
It means an Object Literal (An object that is created using curly brackets and can be defined by using type
or interface
, take a look at this link) that accepts as pairs index: value
of type string:any
. Eg:
let example: info= {
index1: "some index",
index2: 1,
// ...
};