Try enforcing contextual type of array literal elements #19541
Labels
Breaking Change
Would introduce errors in existing code
Committed
The team has roadmapped this issue
Suggestion
An idea for TypeScript
Milestone
Part of #19236
Code
Expected behavior:
s1
should be an errors2
should have an error span on3
Actual behavior:
s1
is not an errors2
has an error span ons2
, which makes it impossible to figure out which element is wrongHypothesis: When checking a contextually-typed array literal, if an element type isn't assignable to the contextual type, issue an error on that element and return
unknownType
The text was updated successfully, but these errors were encountered: