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
I'm opening this bug to discuss a blocker for #2983 that seems significant enough to merit discussion on its own. In the course of trying to fix that issue, I found that Typescript cannot assign the type:
What's going on here is that assignment from a non-union type T to a union type A | B is currently only allowed if T can be assigned to A or to B. However, in this particular case, casework on the type T shows that is indeed a subtype of A | B.
I don't propose to fix this problem in full generality. In fact, that seems pretty much infeasible to me, as I think we can express arbitrary SAT instances as instances of this problem. However, would people be okay with an improvement to the assignment relation specific to this IteratorResult case?
The text was updated successfully, but these errors were encountered:
skishore
changed the title
Improved assignability checks for boolean-discriminated unions
Improved assignability checks for generalized IteratorResults
Jul 19, 2017
skishore
changed the title
Improved assignability checks for generalized IteratorResults
Improved assignability checks for general IteratorResults
Jul 19, 2017
skishore
changed the title
Improved assignability checks for general IteratorResults
Better assignability check for IteratorResult<T,U>
Jul 19, 2017
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
I'm opening this bug to discuss a blocker for #2983 that seems significant enough to merit discussion on its own. In the course of trying to fix that issue, I found that Typescript cannot assign the type:
to the type:
What's going on here is that assignment from a non-union type T to a union type A | B is currently only allowed if T can be assigned to A or to B. However, in this particular case, casework on the type T shows that is indeed a subtype of A | B.
I don't propose to fix this problem in full generality. In fact, that seems pretty much infeasible to me, as I think we can express arbitrary SAT instances as instances of this problem. However, would people be okay with an improvement to the assignment relation specific to this IteratorResult case?
The text was updated successfully, but these errors were encountered: