Given by these 2 string enums with always the same keys:
enum StatusEnum {
SUCCESS = 'SUCCESS',
ERROR = 'ERROR',
WARN = 'WARN',
DEBUG = 'DEBUG',
}
enum RawStatusEnum {
SUCCESS = 'Success',
ERROR = 'Error',
WARN = 'Warn',
DEBUG = 'Debug',
}
I want to cast value of enum RawStatusEnum to value of enum StatusEnum, that is:
const rawEnumValue = RawStatusEnum.ERROR // RawStatusEnum
const normalEnumValue = cast(rawEnumValue) // StatusEnum
But I have problems with typings and ... I've learnt about reverse mapping in typescript here, but reverse mapping works only for numeric enums. Thanks in advance.