mirror of
https://github.com/swc-project/swc.git
synced 2024-12-21 12:41:54 +03:00
40 lines
559 B
TypeScript
40 lines
559 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
|
|
}
|
|
|
|
enum E5 {
|
|
a = 1 / 0,
|
|
b = 2 / 0.0,
|
|
c = 1.0 / 0.0,
|
|
d = 0.0 / 0.0,
|
|
e = NaN,
|
|
f = Infinity,
|
|
g = -Infinity
|
|
}
|
|
|
|
const enum E6 {
|
|
a = 1 / 0,
|
|
b = 2 / 0.0,
|
|
c = 1.0 / 0.0,
|
|
d = 0.0 / 0.0,
|
|
e = NaN,
|
|
f = Infinity,
|
|
g = -Infinity
|
|
}
|