Unions within/without types should be hoisted/canonicalized to improve type compatibility #14865
Labels
Declined
The issue was declined as something which matches the TypeScript vision
Suggestion
An idea for TypeScript
TypeScript Version: 2.2.1
Code
Expected behavior:
No error on the assignment to
b
;Actual behavior:
It's pretty clear that these types are equivalent to the human eye (only the discriminant differs between each member type of
Style1
, which makes it equivalent toStyle2
), however since TS compares memberwise when doing compatibility checking over the union, it never realizes that the overall type of thetype
field is identical.The text was updated successfully, but these errors were encountered: