Skip to content

Allow a const enum to be used before it's declaration #15828

@panost

Description

@panost

TypeScript Version: 2.3
Regression issue with the implementation of #11935

Code

const v: Color = Color.Green;
const enum Color { Red, Green, Blue }

which compiles to:

var v = 1 /* Green */;

Expected behavior:
No error

Actual behavior:
Error on line 1: Enum Color used before its declaration.

Comments:
The above code was successfully compiled in version 2.2. So this is actually a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions