How can I store an object with a dynamically assigned property name in an array, but unsure of how to define the array properly?
class Driver {
public id: string;
public name: string;
constructor(id , name) {
this.id = id;
this.name = name;
}
}
let drivers: Driver[];
let driver = new Driver("1111","tom");
drivers.push({[driver.id]:driver})