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
@osdm You're right, we no longer do subtype reduction in union types, however we still do deduplication as discussed in #4115. This has yet to make it into the spec. In the example above, Array<Undefined> is considered a duplicate of Array<string> so the type of the ?: operation simply becomes Array<string>.
My reasoning follows, please correct me if I'm wrong.
According to 1.5 spec, type of q[0] was calculated in the following way:
Array<string>
and empty array (Array<Undefined>
).Array<string>
, because string is a supertype of undefined.According to 1.6 spec, type of q[0] should be calculated in the following way:
Array<string>
and empty array (Array<Undefined>
).(Array<string> | Array<any>)
.(string | any)
.But that would break "no implicit any". Where did I make a mistake?
The text was updated successfully, but these errors were encountered: