Skip to content

Map and Set sort and sortBy return type #2013

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

Merged
merged 2 commits into from
Oct 17, 2024
Merged

Conversation

jdeniau
Copy link
Member

@jdeniau jdeniau commented Aug 18, 2024

Fixes #2012

@jdeniau
Copy link
Member Author

jdeniau commented Aug 19, 2024

@cypherfunc

I did manage to fix #2012, but there is an issue in inheritance as Set::sort does not return this as specified in Collection.

At runtime this does work, but typescript prevents it at it flags it as an inheritance issue.
I did handle to make it work, but now the returned type is this & OrderedSet<V>.

You can see a simple reproductible example of why on this TS playground

Can you test this in your codebase to check if there is an issue ?

Thank you.

@jdeniau jdeniau added the awaiting-response Awaiting response from creator. Can't fix without it. label Sep 24, 2024
Base automatically changed from 5.x to main October 17, 2024 22:04
An error occurred while trying to automatically change base from 5.x to main October 17, 2024 22:04
@jdeniau jdeniau merged commit 2021417 into main Oct 17, 2024
5 checks passed
@jdeniau jdeniau deleted the map-set-sort-by-return-type branch October 17, 2024 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-response Awaiting response from creator. Can't fix without it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript return type of sort/sortBy on non-Ordered Collections isn't accurate
1 participant