Skip to content

Comparability of Enum values #10631

Closed
Closed
@m1gu3l

Description

@m1gu3l

TypeScript Version: 2.0.2 Release Candidate

Code

enum Place {
    Bottom,
    Left,
    Right,
    Top
}

let p: Place = Place.Left;
console.log(p === Place.Left);
console.log(p === Place.Right);

Expected behavior:
true
false

Actual behavior:
error TS2365: Operator '===' cannot be applied to types 'Place.Left' and 'Place.Right'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions