enums in ts code example
Example 1: ts enum definition
enum PrintMedia {
Newspaper,
Newsletter,
Magazine,
Book
}
Example 2: enum in ts
enum Direction {
Up,
Down,
Left,
Right,
}
Example 3: ts enum
enum Response {
No = 0,
Yes = 1,
}
function respond(recipient: string, message: Response): void {
// ...
}
respond("Princess Caroline", Response.Yes)
Example 4: enums in typescript
enum Direction {
Up = 1,
Down,
Left,
Right,
}