Recently delving into Typescript - I am interested in creating a variable type that is restricted to specific values.
For instance, I have an element where I want to adjust the width based on a "zoom" variable.
I would like to define a variable type called "Zoom", functioning similar to a number but limited to the values 1, 2, 5, 10, 20, 50, or 100 (constraining the zoom levels for the element)
Furthermore, I aim to increment the zoom variable so it cycles through these values as follows:
let zoom: Zoom = 1;
zoom++
// The value of zoom should be 2
zoom++
// The value of zoom should be 5
zoom++
// The value of zoom should be 10
zoom--
// Now, the value of zoom should be 5
And so forth, etc. Is there a straightforward way to accomplish this in Typescript?