Skip to content

Enum member named with a Unicode escape emits the raw escape text #4097

@mds-ant

Description

@mds-ant

Steps to reproduce

main.ts:

enum E {
  \u0041 = 1,
}
const a = E.A;
tsgo main.ts

Behavior with typescript@6.0

"use strict";
var E;
(function (E) {
    E[E["A"] = 1] = "A";
})(E || (E = {}));
const a = E.A;

Here, a evaluates to 1.

Behavior with tsgo

"use strict";
var E;
(function (E) {
    E[E["\\u0041"] = 1] = "\\u0041";
})(E || (E = {}));
const a = E.A;

Here, a evaluates to undefined.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions