es-toolkit
es-toolkit copied to clipboard
fix(groupBy): Use more accurate return type
Summary
Updates the return type of groupBy to reflect that properties need not exist in the output but that if they do, their value has at least length 1. It prevents users from having to suppress unnecessary condition warnings when trying to safely access properties in groupBy results.
Changes
- Wraps
groupByreturn type withPartial - Changes values in
groupByreturn type fromT[]to[T, ...T[]]
Comments
The compat function is still using Record type here instead of Partial<Record>