mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
37 lines
822 B
TypeScript
37 lines
822 B
TypeScript
//// [tests/cases/compiler/enumBasics2.ts] ////
|
|
|
|
//// [enumBasics2.ts]
|
|
enum Foo {
|
|
a = 2,
|
|
b = 3,
|
|
x = a.b, // should error
|
|
y = b.a, // should error
|
|
z = y.x * a.x, // should error
|
|
}
|
|
|
|
enum Bar {
|
|
a = (1).valueOf(), // ok
|
|
b = Foo.a, // ok
|
|
c = Foo.a.valueOf(), // ok
|
|
d = Foo.a.a, // should error
|
|
}
|
|
|
|
|
|
//// [enumBasics2.js]
|
|
"use strict";
|
|
var Foo;
|
|
(function (Foo) {
|
|
Foo[Foo["a"] = 2] = "a";
|
|
Foo[Foo["b"] = 3] = "b";
|
|
Foo[Foo["x"] = Foo.a.b] = "x";
|
|
Foo[Foo["y"] = Foo.b.a] = "y";
|
|
Foo[Foo["z"] = Foo.y.x * Foo.a.x] = "z";
|
|
})(Foo || (Foo = {}));
|
|
var Bar;
|
|
(function (Bar) {
|
|
Bar[Bar["a"] = (1).valueOf()] = "a";
|
|
Bar[Bar["b"] = 2] = "b";
|
|
Bar[Bar["c"] = Foo.a.valueOf()] = "c";
|
|
Bar[Bar["d"] = Foo.a.a] = "d";
|
|
})(Bar || (Bar = {}));
|