Uh oh!
There was an error while loading. Please reload this page.
Make 'pop' the first method that uses 'T' in 'Array' - #25565
Merged
Conversation
Daniel Rosenwasser (DanielRosenwasser)
requested review from
Anders Hejlsberg (ahejlsberg) and Wesley Wigham (weswigham)July 10, 2018 22:12
Daniel Rosenwasser (DanielRosenwasser)force-pushed
the
popFirst
branch
from
July 11, 2018 01:11
28aaf22 to
8a559e4CompareMemberAuthor
Really the RWC baseline changes are minimal, and aren't impacted at all. I'm just seeing reports of missing Argument of type 'Uint8ClampedArray' is not assignable to parameter of type 'any[]'.
+ Property 'pop' is missing in type 'Uint8ClampedArray'.- Property 'push' is missing in type 'Uint8ClampedArray'. |
Sheetal Nandi (sheetalkamat)
approved these changes
Jul 12, 2018
Mohsen Azimi (mohsen1)
commented
Nov 13, 2018
Contributor
Can you improve those errors for Arrays even further. I got confused with code like this: interfaceValues{textValues: {values: string[]}}constitems=[{name: 'a'},{name: 'b'}]varvalues: Values={textValues: items.map(i=>i.name)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 Mohamed Hegazy (@mhegazy) about this, but I'd like to get your thoughts on this Anders Hejlsberg (@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
pushusesTcontravariantly, 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 Cliff Koh (@cliffkoh) and David Zearing (@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.