import { forceExtract, forceToString } from '../../modules/internals'; import { getIndexes } from '../../modules/arrays-and-tuples/infrastructure'; import { isNever } from '../../modules/never/infrastructure'; import { modify } from '../../modules/objects/infrastructure'; import { TupleReduce, UnionMap } from '../iterators/infrastructure'; import { forceConcat } from '../../modules/arrays-and-tuples/app'; import { InternalAdd } from '../math/app/addition'; import { InternalBiggerThan } from '../math/app/arimetic'; interface $CreateGroup extends $<[current: unknown]> { return: InternalBiggerThan<[lastKey], [this[0]]> extends true ? never : GetUnionGroupByNumericOrder, maxLenght, [...Result, this[0]], this[0]>; } type GetUnionGroupByNumericOrder = `${Result['length']}` extends forceToString ? Result : UnionMap>; type GetAllPosibleGroupsByNumericOrder> = isNever extends true ? lastResult : GetAllPosibleGroupsByNumericOrder, lastResult | newResult>; interface $CreateAcumulativeModified extends $<[acc: unknown, current: unknown]> { return: modify, 1> & { readonly [_ in K]: forceConcat, [forceExtract, 0>]>; }>; } interface $CreateAllAcumulativeModified extends $<[current: nLengthTuple]> { return: TupleReduce, T & { [_ in K]: []; }>; } /** * Generates a new type by modifying `mainObj` with a series of overrides specified by `overrides` tuple array. * Each tuple contains a string key and an object with properties to merge into `mainObj`. The result is a union * type representing the combinations the specified order. * * `mainObj`: The primary object type to modify. * * `overrides`: An array of tuples where each tuple contains a string as its first element * to act as a key identifier and an object as its second element to specify the overrides. * * @example * type Result = modifyByKeyPlusOrderedCombinations<{ test: 'test' }, [ * ['fet1', { newprop1: 1 }], * ['fet2', { newprop2: 2 }], * ['fet3', { newprop1: 3; newprop3: 3 }], * ]>; */ export type modifyByKeyPlusOrderedCombinations = (mainObj & { [_ in keyToDiscrimitate]?: undefined; }) | UnionMap>, $CreateAllAcumulativeModified>; export {};