Additive inverse of number literals #30914
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Search Terms
Using unary minus on variable that is of number-literal type. Negative number literals.
Suggestion
This is a specific case of #26382. My proposal is simply that if we apply unary minus on an expression whose type is a union of number literal types, the result should be a union of their additive inverses:
Furthermore we could add a unary minus type operator:
Both should be very easy and uncontroversial to implement.
Use Cases
The type operator would be just for sake of completeness
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: