content
                                
                                 content copied to clipboard
                                
                                    content copied to clipboard
                            
                            
                            
                        Add page for Array_withSorted_argument type error message
Summary
Add page for Array_withSorted_argument type error message
Motivation
Bug 1729563 adds a new Array.prototype.withSorted() method. This method can throw a type error that is similar to the one thrown by Array.prototype.sort() when the function argument is not callable, but the name is different to reflect that the method being erroneously called is withSorted().
Supporting details
Related issues
Metadata
- [X] Adds a new document
- [ ] Rewrites (or significantly expands) a document
- [ ] Fixes a typo, bug, or other error
Preview URLs
Flaws
URL: /en-US/docs/Web/JavaScript/Reference/Errors/Array_withSorted_argument
Title: TypeError: non-function passed to Array.prototype.withSorted
on GitHub
Flaw count: 2
- macros:
- /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/withSorted does not exist
- /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/withSorted does not exist
 
External URLs
URL: /en-US/docs/Web/JavaScript/Reference/Errors/Array_withSorted_argument
Title: TypeError: non-function passed to Array.prototype.withSorted
on GitHub
No new external URLs
(this comment was updated 2022-06-27 12:16:09.202680)
Thanks for writing up the documentation for this @catamorphism.
Is the plan to wait until this proposal manages to advance to stage 3 or 4 before merging?
Thanks for writing up the documentation for this @catamorphism.
Is the plan to wait until this proposal manages to advance to stage 3 or 4 before merging?
Doesn't necessarily have to wait (unless others think it should), but I was encouraged to submit this PR because code landed that references the error message string, so it's a broken link without the MDN page existing. That said, the code is still flag-guarded, so it doesn't seem too urgent to me. (I just haven't had a chance to fix the errors pointed out by the bot yet.)
This PR has been open now for than 7 months, and rather than continuing to keep it open waiting on other things, I suggest we consider closing it for now and then re-opening when it’s clear that things have reached the point where we’re ready to merge it.
I'm curious here. Shouldn't the feature be documented by now? Maybe it skipped through the Mozilla docs process, or there is another reason. @rumyra will know for sure.
The lack of documentation of the main feature is what prevents this from being merged.
Thanks @teoli2003 - yes it would absolutely appear this fell through the net (there is no dev-doc-needed & unfortunately the search to add isn't a perfect science)
I'm going to add some research for change array by copy our current release project, so hopefully we can make progress on this pr 👍
(Sorry I clicked close with comment instead of delete draft comment)
I did some research. I don't think this is worth documenting yet.
- The implementation on FF appears to be stage-2 and is behind a preference. Since then the names of the methods changed from withXxxx to toXxxxx.
- The implementation does not seem to work even if the preference is enabled
- No other browser vendors seem to be signaling interest (though perhaps my basic search wasn't sufficient).
Anyway, I'm querying the status in https://bugzilla.mozilla.org/show_bug.cgi?id=1729563 but until there is at least one browser compliant with the stage 3 spec I'm not sure there is much point documenting it.
- No other browser vendors seem to be signaling interest (though perhaps my basic search wasn't sufficient).
FYI the proposal is currently shipping in Safari tech preview.
Thanks @acutmore ! - As you say, release 148 - change here: https://trac.webkit.org/changeset/293348/webkit/
Let's see what the plan for Firefox is too, and perhaps then I should reconsider.
Sounds good @hamishwillee - thank you!
FYI, the Moz developer responded with what is essentially "still too early" - there are some things going on with the spec and it is still quite possible the names might need to change. The FF implementation isn't even built by default for these reasons. So I take that as still to early to document.
I'm going to close this PR for now and we can reopen when this is ready to document. Thanks all 🙌🏻