Skip to content

Conversation

@nnmrts
Copy link
Contributor

@nnmrts nnmrts commented Jul 26, 2025

Summary

This adds an overload to sort to preserve tuple types.

const list = [{ index: 2 }, { index: 0 }, { index: 1 }] as const

const result = _.sort(list, i => i.index)

result above had this type before:

({
    readonly index: 2;
} | {
    readonly index: 0;
} | {
    readonly index: 1;
})[]

with this PR, it now has this type:

[{
    readonly index: 2;
} | {
    readonly index: 0;
} | {
    readonly index: 1;
}, {
    readonly index: 2;
} | {
    readonly index: 0;
} | {
    readonly index: 1;
}, {
    readonly index: 2;
} | {
    readonly index: 0;
} | {
    readonly index: 1;
}]

which preserves the tuple type and length.

Related issue, if any:

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed
  • Related benchmarks have been added or updated, if needed
  • Release notes in next-minor.md or next-major.md have been added, if needed

Does this PR introduce a breaking change?

No

@nnmrts nnmrts requested a review from aleclarson as a code owner July 26, 2025 05:09
@aleclarson aleclarson added this to the v12.7.0 milestone Sep 17, 2025
@aleclarson
Copy link
Member

Tests are failing

@aleclarson aleclarson modified the milestones: v12.7.0, v12.8.0 Oct 17, 2025
@nnmrts
Copy link
Contributor Author

nnmrts commented Oct 18, 2025

Tests are failing

Thanks for the update. I resolved the merge conflicts, tests seem to be okay now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants