TypeScript/tests/cases/conformance/enums/enumConstantMembers.ts
2014-09-05 18:44:49 -07:00

19 lines
No EOL
306 B
TypeScript

// Constant members allow negatives, but not decimals. Also hex literals are allowed
enum E1 {
a = 1,
b
}
enum E2 {
a = - 1,
b
}
enum E3 {
a = 0.1,
b // Error because 0.1 is not a constant
}
declare enum E4 {
a = 1,
b = -1,
c = 0.1 // Not a constant
}