remarks public export class Enum { private constructor ( ) { } example public static tryGetValueByKey < TEnumValue > ( enumObject , key ) { return enumObject [ key ] as any ; } /**
     * This API is similar to  Enum . tryGetValueByKey , except that it throws an exception
     * if the key is undefined.
      public static getValueByKey < TEnumValue > ( enumObject , key ) { const result = enumObject [ key ] as any ; if ( result === undefined ) { throw new Error ( `The lookup key ${ JSON . stringify ( key ) } is not defined` ) ; } return result ; } remarks example public static tryGetKeyByNumber < TEnumValue , TEnumObject extends { [ key ] : TEnumValue ; } > ( enumObject , value ) { return enumObject [ value ] as any ; } /**
     * This API is similar to  Enum . tryGetKeyByNumber , except that it throws an exception
     * if the key is undefined.
      public static getKeyByNumber < TEnumValue , TEnumObject extends { [ key ] : TEnumValue ; } > ( enumObject , value ) { const result = enumObject [ value ] as any ; if ( result === undefined ) { throw new Error ( `The value ${ value } does not exist in the mapping` ) ; } return result ; } }