I recieve a number type = 3 and have to check if it exists in this enum:
type = 3
export const MESSAGE_TYPE = { INFO: 1, SUCCESS: 2, WARNING:
There is a very simple and easy solution to your question:
var districtId = 210; if (DistrictsEnum[districtId] != null) { // Returns 'undefined' if the districtId not exists in the DistrictsEnum model.handlingDistrictId = districtId; }