Compound assignments and narrowing #9815
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
Noticed a very strange behaviour with compound assignments and narrowing.
This works fine with a normal assignment:
This doesn't work, though:
Seems that in the last case the compiler shouldn't narrow the LHS "x" anyways, but rather it should specially calculate the result type of "+=" assignment taking into account the narrowed version of "x".
The text was updated successfully, but these errors were encountered: