mirror of
https://github.com/swc-project/swc.git
synced 2024-12-19 11:42:13 +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
21 lines
486 B
TypeScript
21 lines
486 B
TypeScript
// @declaration: true
|
|
|
|
// 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
|
|
}
|
|
|
|
// Error from referring constant enum in any other context than a property access
|
|
var z = G;
|
|
var z1 = G[G.A];
|
|
var g: G;
|
|
g = "string";
|
|
function foo(x: G) { }
|
|
G.B = 3;
|