export = smartGrouping; /** * @typedef {Object} GroupOptions * @property {boolean=} groupChildren * @property {boolean=} force * @property {number=} targetGroupCount */ /** * @template T * @template R * @typedef {Object} GroupConfig * @property {function(T): string[]} getKeys * @property {function(string, (R | T)[], T[]): R} createGroup * @property {function(string, T[]): GroupOptions=} getOptions */ /** * @template T * @template R * @typedef {Object} ItemWithGroups * @property {T} item * @property {Set>} groups */ /** * @template T * @template R * @typedef {{ config: GroupConfig, name: string, alreadyGrouped: boolean, items: Set> | undefined }} Group */ /** * @template T * @template R * @param {T[]} items the list of items * @param {GroupConfig[]} groupConfigs configuration * @returns {(R | T)[]} grouped items */ declare function smartGrouping( items: T[], groupConfigs: GroupConfig[], ): (T | R)[]; declare namespace smartGrouping { export { GroupOptions, GroupConfig, ItemWithGroups, Group }; } type GroupConfig = { getKeys: (arg0: T) => string[]; createGroup: (arg0: string, arg1: (R | T)[], arg2: T[]) => R; getOptions?: ((arg0: string, arg1: T[]) => GroupOptions) | undefined; }; type GroupOptions = { groupChildren?: boolean | undefined; force?: boolean | undefined; targetGroupCount?: number | undefined; }; type ItemWithGroups = { item: T; groups: Set>; }; type Group = { config: GroupConfig; name: string; alreadyGrouped: boolean; items: Set> | undefined; };