TypeScript Version: 3.3.0-dev.20190117
Search Terms: enum, casting enum, union type
Code
const enum Direction {
LEFT = "LEFT",
RIGHT = "RIGHT"
}
type DirectionType = "UP" | "DOWN" | Direction;
const myDirection: DirectionType = <Direction>"SOUTHWEST"; // no warning or error
Expected behavior:
Trying to assign "SOUTHWEST" to myDirection should give an error.
Actual behavior:
No warning or error.
TypeScript Version: 3.3.0-dev.20190117
Search Terms: enum, casting enum, union type
Code
Expected behavior:
Trying to assign "SOUTHWEST" to myDirection should give an error.
Actual behavior:
No warning or error.