I noticed that if I have an enum that is composed of numbers, then basically TypeScripts allows assigning any number to the variable of such type:
enum EnumTestA {
foo = 1,
baz = 2
}
const testEnum1: EnumTestA = 4;
The above compile just fine. Why?
If I try to do the same with strings:
enum EnumTestB {
foo = "FOO",
baz = "BAZ"
}
const testEnum2: EnumTestB = "zzz";
Then it refuses to compile it as expected.