Numeric enum
in TypeScript start with 0
by default. This means that if the first member in the enum
has no initializer, it is assigned the value 0
; all members that follow are auto-incremented from that point on.
For example:
enum FooNum { A, B, C, } console.log(FooNum.A); // 0 console.log(FooNum.B); // 1 console.log(FooNum.C); // 2
Hope you found this post useful. It was published . Please show your love and support by sharing this post.