Closed
Description
openedon Aug 9, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment