Closed
Description
TypeScript Version: 2.4.0
Code
enum Colors {
Red = "RED",
Green = "GREEN",
Blue = "BLUE",
}
const c1: Colors = Colors.Red;
const c2: Colors = "RED";
Expected behavior:
I'd expect both lines with c1
and c2
to work but only the first compiles.
Actual behavior:
[ts] Type '"RED"' is not assignable to type 'Colors'.
const c2: Colors