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