This is the typescript code, I want to set enum in the Event object by looking it through value.
I have this enum -
export enum EVENT_TYPE_ENUM {
EVENT_TYPE_ONE = "evt.1",
EVENT_TYPE_TWO = "evt.2",
}
I have this object -
export class Event{
private eventType: EVENT_TYPE_ENUM;
public getEventType(): EVENT_TYPE_ENUM {
return this.eventType;
}
public setEventType(eventType: EVENT_TYPE_ENUM): void {
this.eventType = eventType;
}
}
I want to set eventType on my Event object by searching EVENT_TYPE_ENUM by value. for example, I have received value as "evt.1" now I want search the EVENT_TYPE_ENUM and set eventType, the setter method only accepts type as EVENT_TYPE_ENUM.
const event = new Event();
event.setEventType(); //set value here by searching EVENT_TYPE_ENUM by value
of evt.1