import { IterableX } from '../../iterable/iterablex.js'; import { groupBy, GroupedIterable } from '../../iterable/operators/groupby.js'; import { identity } from '../../util/identity.js'; export function groupByProto( this: IterableX, keySelector: (value: TSource) => TKey ): IterableX>; export function groupByProto( this: IterableX, keySelector: (value: TSource) => TKey, elementSelector?: (value: TSource) => TValue ): IterableX>; export function groupByProto( this: IterableX, keySelector: (value: TSource) => TKey, elementSelector: (value: TSource) => TValue = identity ): IterableX> { return groupBy(keySelector, elementSelector)(this); } IterableX.prototype.groupBy = groupByProto; declare module '../../iterable/iterablex' { interface IterableX { groupBy: typeof groupByProto; } }