when I define an enum like this:
enum Dir {
Up: 1,
Down: 2
}
And then initialize a variable with its type cast to the enum Dir:
let dir: Dir;
dir = 3
I get no error. But when I make the enum string type like so,
enum Dir {
Up: 'Up',
Down: 'Down'
}
And then,
let dir: Dir;
dir = 'Left';
I get a compilation error. But in both cases, I assigned a value to dir variable that was not present in the enum. Why different behaviors for number and string types?