数字枚举

enum Direction {
    Up = 1,
    Down,
    Left,
    Right
}

enum Direction {
    Up,
    Down,
    Left,
    Right,
}
enum Response {
    No = 0,
    Yes = 1,
}

function respond(recipient: string, message: Response): void {
    // ...
}

respond("Princess Caroline", Response.Yes)

字符串枚举

enum Direction {
    Up = "UP",
    Down = "DOWN",
    Left = "LEFT",
    Right = "RIGHT",
}