Enums

Enums

Enums are compatible with numbers, and numbers are compatible with enums. Enum values from different enum types are considered incompatible. For example,

1
2
3
4
5
enum Status { Ready, Waiting };
enum Color { Red, Blue, Green };
 
let status = Status.Ready;
status = Color.Green;  //error
doc_TypeScript
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.