I've got this class:
export class AccountApprovedColumnFilter {
public showRowNumber: boolean = true;
public showImage: boolean = true;
public showProduct: boolean = true;
public showCategory: boolean = true;
public showGender: boolean = true;
public showSupplyingAccount: boolean = true;
public showSalesOrder: boolean = true;
public showRequestedUnits: boolean = true;
public showApprovedUnits: boolean = true;
public showSizeDetails: boolean = true;
public showSubmit: boolean = true;
public reset(): void {
for (let key in this) {
if (this.hasOwnProperty(key)) {
this[key] = true;
}
}
}
}
But Visual Studio complains about this line:
this[key] = true;
Type 'true' is not assignable to type 'this[keyof this]'.
How do I cast this properly?