I have a custom "Enum" interface that that has a value and a description. I've defined an my enum interface like this-
module App {
export interface IMyEnum {
[index: string]: IMyEnumValue;
}
export interface IMyEnumValue {
value: any;
text: string;
}
}
And my enums like this-
/// <reference path="./enums.interface.ts"/>
module App {
export const StatusEnum: IMyEnum = {
Normal: { value: 100, text: 'Normal' },
Overdue: { value: 200, text: 'Overdue' },
Critical: { value: 300, text: 'Critical' }
}
}
But the typescript compiler is complaining that "Normal" does not exist on type IMyEnum.
let statusCode = StatusEnum.Normal.value;
Is there anyway to do this without defining an IStatusEnum interface? I think that would be over-engineering.
Normalin"Normal"