Skip to content

Ordering sensitivity of exported enums and usages #2594

@robertknight

Description

@robertknight

With default compile settings, the following works under TS 1.4 but fails under TS 1.5.0-alpha due to Color being undefined until the code generated for the exported enum has been evaluated because the default output for enums changed from emitting constants to references to 'Color.Red'.

// compile with 'tsc -m enum.ts'

var value = Color.Red;

export enum Color {
    Red
}

I'm unsure if this is considered a bug or simply a compatibility hazard to document?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking ChangeWould introduce errors in existing code

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions