You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, operations between literals are not considered as literals. It would bring much more flexibility to have this feature.
Use Cases
Operations on literals could help having better declarations and would help having more complex enums
Examples
// extract of enumassignmentcompat5.ts (which is not anymore in the repo BTW)enumE{A,B,C}enumComputed{
A =1<<1,
B =1<<2,
C =1<<3,}let ca: Computed.A=1;// ok, because 1( left hand side operand) and 1 (right hand side operand) are literals, therefore, 1<<1 is also a literal.
Checklist
My suggestion meets these guidelines:
This wouldn't be a breaking change in existing TypeScript/JavaScript code
This wouldn't change the runtime behavior of existing JavaScript code
This could be implemented without emitting different JS based on the types of the expressions
This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
Search Terms
enumassignmentcompat5.ts, ts2535
Suggestion
Currently, operations between literals are not considered as literals. It would bring much more flexibility to have this feature.
Use Cases
Operations on literals could help having better declarations and would help having more complex enums
Examples
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: