export class Enum { protected static indexes: string[] = []; static values(): T[] { return this.indexes.map(key => (this as unknown as Record)[key]); } static valueOf(key: string): T { return (this as unknown as Record)[key]; } protected constructor() { } get className() { return "Enum"; } name(): string { throw new Error("Method not implemented"); } ordinal(): number { return (this.constructor as typeof Enum).indexes.indexOf(this.name()); } toString(): string { return this.name(); } } export default Enum;