I can merge enum declarations within a single file e.g.
export enum Test {
value1 = \'value1\',
value2 = \'value2\'
}
export enum
I saw a way that you can add additional function/method in an existing enum. this is by create the function within a namespace similar to the enum type: Here
enum Weekday {
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
}
namespace Weekday {
export function isBusinessDay(day: Weekday) {
switch (day) {
case Weekday.Saturday:
case Weekday.Sunday:
return false;
default:
return true;
}
}
}
const mon = Weekday.Monday;
const sun = Weekday.Sunday;
console.log(Weekday.isBusinessDay(mon)); // true
console.log(Weekday.isBusinessDay(sun)); // false
You can see the complete information here https://basarat.gitbooks.io/typescript/docs/enums.html at section "Enum with static functions"