Skip to content

Const enum by-const-enum-reference value not elided in incremental build #19898

@jkieboom

Description

@jkieboom

TypeScript Version: 2.7.0-dev.20171109

Code

// file1.ts
export const enum E1 {
  V = 1
}

// file2.ts
import { E1 } from "./file1";

export const enum E2 {
  V = E1.V
}

// file3.ts
import { E2 } from "./file2";

const v: E2 = E2.V;

Expected behavior:

The value of v in file3 when compiled should always be 1.

Actual behavior:

When running tsc in watch mode, when file3 changes and is recompiled, the resulting javascript now contains v = E2.V instead of the constant 1, and fails at runtime with an unknown reference.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issueHigh Priority

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions