mirror of
https://github.com/swc-project/swc.git
synced 2024-11-28 02:29:04 +03:00
b887b30092
**Description:** This is required for https://github.com/swc-project/swc/pull/6981 and https://github.com/swc-project/swc/pull/6950
33 lines
552 B
TypeScript
33 lines
552 B
TypeScript
// @declaration: true
|
|
// @target: es6
|
|
|
|
// constant enum declarations are completely erased in the emitted JavaScript code.
|
|
// it is an error to reference a constant enum object in any other context
|
|
// than a property access that selects one of the enum's members
|
|
|
|
const enum G {
|
|
A = 1,
|
|
B = 2,
|
|
C = A + B,
|
|
D = A * 2
|
|
}
|
|
|
|
var o: {
|
|
[idx: number]: boolean
|
|
} = {
|
|
1: true
|
|
};
|
|
|
|
var a = G.A;
|
|
var a1 = G["A"];
|
|
var g = o[G.A];
|
|
|
|
class C {
|
|
[G.A]() { }
|
|
get [G.B]() {
|
|
return true;
|
|
}
|
|
set [G.B](x: number) { }
|
|
}
|
|
|