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
{{ message }}
Repository navigation
Quick info shows method with type any[] at declaration and string[] at use #16643
The method m is contextually typed by the type of the property m within I
The return expressions of m are contextually typed by the return type of the m within I
The array literal is contextually typed, but arrays only change their type when contextually typed by a tuple type. You end up with a regular array whose element type is the widening undefined type.
Would it be reasonable for an empty array literal with a contextual type to just acquire the element type as its own? Even if the contextual type isn't a tuple
That said, I think the current behavior is reasonable. After all, the method does return an empty array.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
DanielRosenwasser commentedon Jun 20, 2017
Here's what's happening here:
Imis contextually typed by the type of the propertymwithinImare contextually typed by the return type of themwithinIundefinedtype.JsonFreeman commentedon Jun 21, 2017
Would it be reasonable for an empty array literal with a contextual type to just acquire the element type as its own? Even if the contextual type isn't a tuple
That said, I think the current behavior is reasonable. After all, the method does return an empty array.
mhegazy commentedon Aug 17, 2017
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.