typescript enum valueOf code example
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: declare enum in type script
enum PrintMedia {
Newspaper = 1,
Newsletter,
Magazine,
Book
}