Skip to content

Commit

Permalink
Add type hint for groupBy - string param variant
Browse files Browse the repository at this point in the history
  • Loading branch information
xanderberkein authored and peterver committed May 14, 2024
1 parent d65324b commit 2195883
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/array/groupBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ const defaultHandler = () => FALLBACK;
* }
*
* @param {T[]} arr - Array to group
* @param {Handler<T>|string} handler - String or a function, determines what to group by
* @param {Handler<T>|keyof T} handler - String or a function, determines what to group by
* @returns {Record<string, T[]>}
*/
function groupBy <T extends Record<string, any>> (
arr:T[],
handler:Handler<T>|string
handler:Handler<T>|keyof T
):Record<string, T[]> {
if (!Array.isArray(arr)) return {};

Expand Down

0 comments on commit 2195883

Please sign in to comment.