Specification for Enum's needs to use 'SignedInteger' in constant productions, not NumericLiteral #538
Labels
Spec
Issues related to the TypeScript language specification
Milestone
Courtsey of @CyrusNajmabadi
The spec currently lists this in the grammar productions for an Enum:
This is slightly incorrect (and different from a previous version of the spec).
Specifically, previous versions used:
The approach with "SignedInteger" is likely more correct. NumericLiteral doesn't allow for things like "-1". With the grammar productions as they exist in the latest version of the spec "-1" would be thought of as a computed expression. i.e. the negation expression of the literal '1'.
This is important if we consider "-1" as a constant or not in an enum. Right now we do. But according to the spec, it would not be.
Also, with "PropertyName = NumericLiteral" we can do "Foo = 3.14159" and that would be considered a constant. That's likely not at all what we want
The text was updated successfully, but these errors were encountered: