Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JSDoc for Array#sort, TypedArray#sort and Array#toSorted methods #60983

Merged
merged 2 commits into from
Jan 16, 2025

Conversation

BitFlippa27
Copy link
Contributor

@BitFlippa27 BitFlippa27 commented Jan 16, 2025

Fixes #60978

The description in the JSDoc comment for the ES2023 toSorted method is incorrect. The default sorting order for JavaScript arrays is not ASCII character order but UTF-16 code unit order. This applies to both Array.prototype.sort and Array.prototype.toSorted.
Further the default sort order for TypedArray.prototype.sort is numerical order.

Summary of changes

  1. Array.prototype.sort: Updated JSDoc to mention UTF-16 code unit order.
  2. TypedArray.prototype.sort: Updated JSDoc to mention numerical order.
  3. Array.prototype.toSorted: Updated JSDoc to mention UTF-16 code unit order.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jan 16, 2025
@BitFlippa27
Copy link
Contributor Author

@microsoft-github-policy-service agree

@typescript-bot typescript-bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jan 16, 2025
@RyanCavanaugh RyanCavanaugh merged commit 7901a39 into microsoft:main Jan 16, 2025
32 checks passed
@BitFlippa27 BitFlippa27 deleted the fix-array-sort-doc branch January 17, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Status: Done
3 participants