enum example in typescript
Example 1: typescript type from enum values
enum Weekday {
MONDAY = 'mon',
TUESDAY = 'tue',
WEDNESDAY = 'wed'
}
type WeekdayType = `${Weekday}`;
Example 2: enum in ts
enum Direction {
Up,
Down,
Left,
Right,
}
Example 3: enums in typescript
enum Direction {
Up = 1,
Down,
Left,
Right,
}