Simplified Keys in TypeScript
It is not necessary to specify keys for all elements. It is enough to specify it for the first element and the keys of the following elements will increase in order. Example:
enum Season { Winter = 1, Spring, Summer, Autumn };
Let's check:
let current: Season = Season.Summer;
console.log(current); // will output 3
Tell me what the result of running the following code will be:
enum Fruits { Apples = 1, Bananas, Oranges, Grapes };
let myFruit: Fruits = Fruits.Grapes;
console.log(myFruit);