Let's imagine that we have the object with following keys: (The number of keys always is 30)
const options = {
"option1": 582, // Random value
"option1": 6,
"option3": 123,
"option4": 3812,
// ...
"option30": 482,
}
So, one of the way to declare an interface for this object would be the following example:
interface IProperties {
"option1": number,
"option2": number,
"option3": number,
"option4": number,
// ...
"option30": number
}
But what if there are will be more options than 30? (1000 for example) It will be silly to write an interface with 1000 keys.
So, which is the best solution for this situation? How we can generate keys dynamically in interface instead of hardcode? May be we can generates the keys in loop?