2014-09-12 22:35:07 +02:00
|
|
|
tests/cases/conformance/enums/enumConstantMembers.ts(12,5): error TS1061: Enum member must have initializer.
|
|
|
|
tests/cases/conformance/enums/enumConstantMembers.ts(18,5): error TS1066: Ambient enum elements can only have integer literal initializers.
|
|
|
|
|
|
|
|
|
2014-09-06 03:42:05 +02:00
|
|
|
==== tests/cases/conformance/enums/enumConstantMembers.ts (2 errors) ====
|
|
|
|
// 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
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1061: Enum member must have initializer.
|
2014-09-06 03:42:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
declare enum E4 {
|
|
|
|
a = 1,
|
|
|
|
b = -1,
|
|
|
|
c = 0.1 // Not a constant
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1066: Ambient enum elements can only have integer literal initializers.
|
2014-09-06 03:42:05 +02:00
|
|
|
}
|