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 suppose that the [] literal doesn't infer undefined as a type of its elements, does it?
The text was updated successfully, but these errors were encountered:
DanielRosenwasser
added
By Design
Deprecated - use "Working as Intended" or "Design Limitation" instead
Duplicate
An existing issue was already created
and removed
By Design
Deprecated - use "Working as Intended" or "Design Limitation" instead
labels
Apr 2, 2016
and you'll see the null type surface itself as well!
Here's what's happening:
We've seen an array literal. We try to get the best common type of its elements.
There are no elements to infer from. We default to the undefined type. Why? Well typically we'll be widened to any[] if it matters anyway.
x has a type annotation. Rather than inferring the widened type of its initializer, we'll just check against string.
Compare undefined[] to string and you get this confusing error message.
We have #6524 to track this issue, but since the null and undefined types are actually going to be representable in 2.0, I'm inclined to say that this is not really bad.
i suppose that the
[]
literal doesn't inferundefined
as a type of its elements, does it?The text was updated successfully, but these errors were encountered: