Skip to content

More helpful error message for mistakenly using : instead of = in Enum #838

@chrisbubernak

Description

@chrisbubernak

In the following test case the compiler gives an error message about expecting a comma. What I believe is going on here is that a ":" is mistakenly being used instead of a an "=". It might make sense to return this suggestion to the user instead of the more generic error that a comma is expected.

==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts (3 errors) ====
enum E2 { a, }
enum E3 { a: 1, }
!!! error TS1005: ',' expected.
enum E1 { a, b: 1, c, d: 2 = 3 }
!!! error TS1005: ',' expected.
!!! error TS1005: ',' expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions