Интерфейс TypeScript с неизвестными ключами
//credit goes to Andrés Reales
interface AllPropertiesString {
[key: number]: string;
[key: string]: string;
}
const random: AllPropertiesString = <AllPropertiesString>{};
random[1] = 'This is the value for number 1';
random['1'] = 'This is a string';
console.log(random[1]); // will display 'This is a string'
console.log(random["1"]); // will display 'This is a string'
Farwa Miraj