Skip to content

VS 2013 save and compile output vs build compile output #1812

@craigktreasure

Description

@craigktreasure

I have an enum in an interface that, when used in my TS code in TypeScript 1.3, was output as a constant. This is no longer the case in 1.4 after saving my file. When i build the project, the enum code is properly output as a constant. Using VS 2013 update 4 with TypeScript 1.4 installed.

Enum declaration file (Colors.d.ts):

declare module server {
    enum Colors {
        Red = 0,
        Green = 0,
        Blue = 0
    }
}

TS Code:

if(box.color === server.Colors.Red) {
...
}

JS Output after save:

if(box.color === server.Colors.Red) {
...
}

JS Output after build (correct, or what i consider to be correct since there is no implementation of the enum):

if(box.color === 0 /* Red */) {
...
}

The same is observed if the enum is declared using the new "const enum" feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions