Skip to content

const enum is broken #2741

Closed
Closed
@khoden

Description

@khoden

OS?

Mac OSX Sierra

Versions.

1.0.0-beta.17

Repro steps.

ng new --prefix=t check-enum
cd check-enum/
ng serve

then add to main.ts (no matter, may be any *.ts)

declare namespace Sts {
  export const enum A{
    a, b, c
  }
}
console.log(Sts.A.a, Sts.A.b);

The log given by the failure.

main.bundle.js:65131 Uncaught ReferenceError: Sts is not defined

Actual in main.bundle.js

console.log(Sts.A.a, Sts.A.b); (see at Source panel of Chrome Developer Tools)

Expected in main.bundle.js

console.log(0 /* a */, 1 /* b */);

If I run tsc from src directory, this code will be in dist/out-tsc, as expected. TypeScript is OK!

Mention any other details that might be useful.

I donn't know, where is a mistake, in angular-cli or its configuration or deps. Generated code is same, as without const keyword. This is very strange.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: investigationRequires some digging to determine if action is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions