Let's say, MyEnum is a TS Enum of this kind (numeric, continuous):
export enum MyEnum {
optionOne,
optionTwo,
// more opions ...
}
and I want to increment it by one and use the result as a parameter for the next method call. This makes the compiler happy:
private DoSomething(currentValue: MyEnum): void {
let nextEnumValue = <MyEnum>(<number><unknown>currentValue + 1);
this.DoMore(nextEnumValue);
}
private DoMore(currentValue: MyEnum): void {
// Something ...
}
Is there an easier (and type-safer) way to obtain nextEnumValue
?