Provided are the following classes:
class EnumerationDTO {
designation: string;
id: number;
}
class ExecutionStatusDTO extends EnumerationDTO {
static readonly open: ExecutionStatusDTO = { id: 0, designation: 'Open' };
static readonly working: ExecutionStatusDTO = { id: 1, designation: 'Working' };
static readonly waiting: ExecutionStatusDTO = { id: 2, designation: 'Waiting' };
static readonly resting: ExecutionStatusDTO = { id: 3, designation: 'Resting' };
static readonly escalated: ExecutionStatusDTO = { id: 4, designation: 'Escalated' };
static readonly done: ExecutionStatusDTO = { id: 5, designation: 'Done' };
static readonly removed: ExecutionStatusDTO = { id: 6, designation: 'Removed' };
}
I am tasked with tallying the occurrences of each instance of ExecutionStatusDTO
in an array and storing that tally in an object of the following type:
type statusesCount: {
done: number;
escalated: number;
open: number;
removed: number;
resting: number;
waiting: number;
working: number;
}
However, statusesCount
cannot simply be declared but must be derived from ExecutionStatsDTO