Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

String enums have reverse mapping #16761

Copy link
Copy link

Description

@StrahilKazlachev
Issue body actions

TypeScript Version: 2.4.0 / nightly (2.5.0-dev.20170627)

In the PR for string enums it is said they do not have reverse mapping. When I compile the following I get a different output from the shown in the PR. Is this a change?

Code

enum ActionType {
    AddUser = "ADD_USER",
    DeleteUser = "DELETE_USER",
    RenameUser = "RENAME_USER"
}

enum Mixed {
    A,
    B,
    C = "hi",
    D = 10,
    E,
    F = "bye"
}

Expected behavior:

var ActionType;
(function (ActionType) {
    ActionType["AddUser"] = "ADD_USER";
    ActionType["DeleteUser"] = "DELETE_USER";
    ActionType["RenameUser"] = "RENAME_USER";
})(ActionType || (ActionType = {}));

var Mixed;
(function (Mixed) {
    Mixed[Mixed["A"] = 0] = "A";
    Mixed[Mixed["B"] = 1] = "B";
    Mixed["C"] = "hi";
    Mixed[Mixed["D"] = 10] = "D";
    Mixed[Mixed["E"] = 11] = "E";
    Mixed["F"] = "bye";
})(Mixed || (Mixed = {}));

Actual behavior:

var ActionType;
(function (ActionType) {
    ActionType[ActionType["AddUser"] = "ADD_USER"] = "AddUser";
    ActionType[ActionType["DeleteUser"] = "DELETE_USER"] = "DeleteUser";
    ActionType[ActionType["RenameUser"] = "RENAME_USER"] = "RenameUser";
})(ActionType || (ActionType = {}));

var Mixed;
(function (Mixed) {
    Mixed[Mixed["A"] = 0] = "A";
    Mixed[Mixed["B"] = 1] = "B";
    Mixed[Mixed["C"] = "hi"] = "C";
    Mixed[Mixed["D"] = 10] = "D";
    Mixed[Mixed["E"] = 11] = "E";
    Mixed[Mixed["F"] = "bye"] = "F";
})(Mixed || (Mixed = {}));
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalRelates to another program, environment, or user action which we cannot control.Relates to another program, environment, or user action which we cannot control.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.