Make 'pop' the first method that uses 'T' in 'Array' #25565
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Chatted with @mhegazy about this, but I'd like to get your thoughts on this @ahejlsberg since you sent out #436.
When elaborating errors on an
Array<Foo>
to anArray<Bar>
, diving into a structural comparison is often dizzying for the user since the first elaboration occurs onpush
.Since
push
usesT
contravariantly, we'll end up flipping the direction which is much more difficult for users to parse. Furthermore, in cases where the covariant check would provide better error messages and error message spans (such as excess property checking spans, and picking better branches in unions), we would end up doing significantly worse.As an example from @cliffkoh and @dzearing, the following
Provides an error on
blah
:Whereas with this change, we provide an error on
jj
(the excess property):This is horrifyingly longer, but it gives the right span and gets to the root cause at the end.