You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enum Color {
Red = 1,
Yellow = 2
}
let color1: Color = 3; // fail
let color2: Color = 3 as Color; // should this be allowed?
π Actual behavior
This line does not throw an error
let color2: Color = 3 as Color; // should this be allowed?
π Expected behavior
The aim of the enum overhaul was to catch errors where illegal values are assigned to the enum. With "as" being still present, it is still possible to assign illegal values.