import { IEnumerable , IEqualityComparer , IGrouping , SelectorKeyType } from "../../types" ; import { groupBy_1 , groupBy_1_Simple } from "./groupByShared" ; export type GroupByWithSelFunc = { param source param keySelector param elementSelector returns < TSource , TKey extends SelectorKeyType , TElement > ( source , keySelector , elementSelector ) : IEnumerable < IGrouping < TKey , TElement > > ; param source param keySelector param elementSelector param comparer returns < TSource , TKey , TElement > ( source , keySelector , elementSelector , comparer ) : IEnumerable < IGrouping < TKey , TElement > > ; } ; export const groupByWithSel = < TSource , TKey , TElement > ( source , keySelector , elementSelector , comparer ? ) : IEnumerable < IGrouping < ReturnType < typeof keySelector > , TElement > > => { if ( comparer ) { return groupBy_1 ( source , keySelector as ( x : TSource ) => TKey , elementSelector , comparer ) ; } else { return groupBy_1_Simple ( source , keySelector as ( x : TSource ) => number | string , elementSelector ) ; } } ;