-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Won't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix itThe severity and priority of this issue do not warrant the time or complexity needed to fix it
Description
TypeScript Version: 2.2.1 / Playground
Code
var s10: 10 = 10;
s10++;
s10 += 1;
s10 = s10 + 1; // Type 'number' is not assignable to type '10'.
Expected behavior:
Compiler errors on all three lines
Actual behavior:
Only errors on the last line.
This looks like a clear bug. A bit more subtle case is a union of literals where increment may or may not lead to the correct type. That subtlety should probably be folded into integer types, and ignored for now. Increments and +=
on literal type should error.
cshaa, collin5, KSXGitHub, NN---, Ginden and 3 more
Metadata
Metadata
Assignees
Labels
Won't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix itThe severity and priority of this issue do not warrant the time or complexity needed to fix it