Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Revert previous assertion as it introduced a regression #2102

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
May 5, 2025
Merged

Conversation

jdeniau
Copy link
Member

@jdeniau jdeniau commented May 5, 2025

Superseed #2100

Revert a change introduced in Commit 53237d2.

Previously, grouping by a function that might return undefined was tolerated, but in the latest version, this now throws.

This PR does add @giggo1604 changes, but improve the TS typing directly

giggo1604 and others added 2 commits April 30, 2025 11:14
It seems reasonable to assert that keys shouldn't be undefined,
since keys are supposed to be of type PropertyKey (string | number | symbol).
But in practice, JavaScript allows undefined as a key by implicitly
converting it to the string "undefined".

This caused a regression specifically in the `groupBy` function, where the
grouper callback can return undefined for some items. That behavior was
previously supported and is now broken by the assertion.

Long-term, it probably makes sense to tighten this up and only allow
real PropertyKeys, but that’ll need a more careful cleanup.
@jdeniau
Copy link
Member Author

jdeniau commented May 5, 2025

Output diff failing test is under control as we change a TS file that does change the builded output.
This has been set to check that file migration from JS to TS does not alter the output in v5.

@jdeniau jdeniau marked this pull request as ready for review May 5, 2025 21:51
@jdeniau jdeniau merged commit 29431bd into main May 5, 2025
5 of 6 checks passed
@jdeniau jdeniau deleted the giggo1604-main branch May 5, 2025 21:52
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