import _ = require("../index"); // eslint-disable-next-line @definitelytyped/strict-export-declare-modifiers type GlobalPartial = Partial; export const uniqueSymbol: unique symbol; declare module "../index" { type Omit = Pick>; type PartialObject = GlobalPartial; type Many = T | readonly T[]; type ImpChain = T extends { __trapAny: any } ? Collection & Function & Object & Primitive & String : T extends null | undefined ? never : T extends string ? String : T extends (...args: any) => any ? Function : T extends List | null | undefined ? Collection : T extends object | null | undefined ? Object : Primitive; type ExpChain = T extends { __trapAny: any } ? CollectionChain & FunctionChain & ObjectChain & PrimitiveChain & StringChain : T extends null | undefined ? never : T extends string ? StringChain : T extends (...args: any) => any ? FunctionChain : T extends List | null | undefined ? CollectionChain : T extends object | null | undefined ? ObjectChain : PrimitiveChain; interface LoDashStatic { /** * Creates a lodash object which wraps value to enable implicit method chain sequences. * Methods that operate on and return arrays, collections, and functions can be chained together. * Methods that retrieve a single value or may return a primitive value will automatically end the * chain sequence and return the unwrapped value. Otherwise, the value must be unwrapped with value(). * * Explicit chain sequences, which must be unwrapped with value(), may be enabled using _.chain. * * The execution of chained methods is lazy, that is, it's deferred until value() is * implicitly or explicitly called. * * Lazy evaluation allows several methods to support shortcut fusion. Shortcut fusion * is an optimization to merge iteratee calls; this avoids the creation of intermediate * arrays and can greatly reduce the number of iteratee executions. Sections of a chain * sequence qualify for shortcut fusion if the section is applied to an array and iteratees * accept only one argument. The heuristic for whether a section qualifies for shortcut * fusion is subject to change. * * Chaining is supported in custom builds as long as the value() method is directly or * indirectly included in the build. * * In addition to lodash methods, wrappers have Array and String methods. * The wrapper Array methods are: * concat, join, pop, push, shift, sort, splice, and unshift. * The wrapper String methods are: * replace and split. * * The wrapper methods that support shortcut fusion are: * at, compact, drop, dropRight, dropWhile, filter, find, findLast, head, initial, last, * map, reject, reverse, slice, tail, take, takeRight, takeRightWhile, takeWhile, and toArray * * The chainable wrapper methods are: * after, ary, assign, assignIn, assignInWith, assignWith, at, before, bind, bindAll, bindKey, * castArray, chain, chunk, commit, compact, concat, conforms, constant, countBy, create, * curry, debounce, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith, * drop, dropRight, dropRightWhile, dropWhile, extend, extendWith, fill, filter, flatMap, * flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, flow, flowRight, * fromPairs, functions, functionsIn, groupBy, initial, intersection, intersectionBy, intersectionWith, * invert, invertBy, invokeMap, iteratee, keyBy, keys, keysIn, map, mapKeys, mapValues, * matches, matchesProperty, memoize, merge, mergeWith, method, methodOf, mixin, negate, * nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, partial, partialRight, * partition, pick, pickBy, plant, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, * push, range, rangeRight, rearg, reject, remove, rest, reverse, sampleSize, set, setWith, * shuffle, slice, sort, sortBy, sortedUniq, sortedUniqBy, splice, spread, tail, take, * takeRight, takeRightWhile, takeWhile, tap, throttle, thru, toArray, toPairs, toPairsIn, * toPath, toPlainObject, transform, unary, union, unionBy, unionWith, uniq, uniqBy, uniqWith, * unset, unshift, unzip, unzipWith, update, updateWith, values, valuesIn, without, wrap, * xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, and zipWith. * * The wrapper methods that are not chainable by default are: * add, attempt, camelCase, capitalize, ceil, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, * conformsTo, deburr, defaultTo, divide, each, eachRight, endsWith, eq, escape, escapeRegExp, * every, find, findIndex, findKey, findLast, findLastIndex, findLastKey, first, floor, forEach, * forEachRight, forIn, forInRight, forOwn, forOwnRight, get, gt, gte, has, hasIn, head, * identity, includes, indexOf, inRange, invoke, isArguments, isArray, isArrayBuffer, * isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, * isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, * isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, * isSafeInteger, isSet, isString, isUndefined, isTypedArray, isWeakMap, isWeakSet, join, * kebabCase, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, max, maxBy, mean, meanBy, * min, minBy, multiply, noConflict, noop, now, nth, pad, padEnd, padStart, parseInt, pop, * random, reduce, reduceRight, repeat, result, round, runInContext, sample, shift, size, * snakeCase, some, sortedIndex, sortedIndexBy, sortedLastIndex, sortedLastIndexBy, startCase, * startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy, * template, times, toFinite, toInteger, toJSON, toLength, toLower, toNumber, toSafeInteger, * toString, toUpper, trim, trimEnd, trimStart, truncate, unescape, uniqueId, upperCase, * upperFirst, value, and words. **/ (value: TrapAny): Collection & Function & Object & Primitive & String; (value: T): String; (value: T): Primitive; (value: string | null | undefined): String; any>(value: T): Function; (value: List | null | undefined): Collection; (value: T | null | undefined): Object; (value: T): Primitive; /** * The semantic version number. **/ VERSION: string; /** * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby * (ERB). Change the following template settings to use alternative delimiters. **/ templateSettings: TemplateSettings; } /** * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby * (ERB). Change the following template settings to use alternative delimiters. **/ interface TemplateSettings { /** * The "escape" delimiter. **/ escape?: RegExp | undefined; /** * The "evaluate" delimiter. **/ evaluate?: RegExp | undefined; /** * An object to import into the template as local variables. */ imports?: Dictionary | undefined; /** * The "interpolate" delimiter. */ interpolate?: RegExp | undefined; /** * Used to reference the data object in the template text. */ variable?: string | undefined; } /** * Creates a cache object to store key/value pairs. */ interface MapCache { /** * Removes `key` and its value from the cache. * @param key The key of the value to remove. * @return Returns `true` if the entry was removed successfully, else `false`. */ delete(key: any): boolean; /** * Gets the cached value for `key`. * @param key The key of the value to get. * @return Returns the cached value. */ get(key: any): any; /** * Checks if a cached value for `key` exists. * @param key The key of the entry to check. * @return Returns `true` if an entry for `key` exists, else `false`. */ has(key: any): boolean; /** * Sets `value` to `key` of the cache. * @param key The key of the value to cache. * @param value The value to cache. * @return Returns the cache object. */ set(key: any, value: any): this; /** * Removes all key-value entries from the map. */ clear?: (() => void) | undefined; } interface MapCacheConstructor { new (): MapCache; } interface Collection { pop(): T | undefined; push(...items: T[]): this; shift(): T | undefined; sort(compareFn?: (a: T, b: T) => number): this; splice(start: number, deleteCount?: number, ...items: T[]): this; unshift(...items: T[]): this; } interface CollectionChain { pop(): ExpChain; push(...items: T[]): this; shift(): ExpChain; sort(compareFn?: (a: T, b: T) => number): this; splice(start: number, deleteCount?: number, ...items: T[]): this; unshift(...items: T[]): this; } interface Function any> extends LoDashImplicitWrapper { } interface String extends LoDashImplicitWrapper { } interface Object extends LoDashImplicitWrapper { } interface Collection extends LoDashImplicitWrapper { } interface Primitive extends LoDashImplicitWrapper { } interface FunctionChain any> extends LoDashExplicitWrapper { } interface StringChain extends LoDashExplicitWrapper { } interface StringNullableChain extends LoDashExplicitWrapper { } interface ObjectChain extends LoDashExplicitWrapper { } interface CollectionChain extends LoDashExplicitWrapper { } interface PrimitiveChain extends LoDashExplicitWrapper { } type NotVoid = unknown; type IterateeShorthand = PropertyName | [PropertyName, any] | PartialShallow; type ArrayIterator = (value: T, index: number, collection: T[]) => TResult; type TupleIterator = (value: T[number], index: StringToNumber, collection: T) => TResult; type ListIterator = (value: T, index: number, collection: List) => TResult; type ListIteratee = ListIterator | IterateeShorthand; type ListIterateeCustom = ListIterator | IterateeShorthand; type ListIteratorTypeGuard = (value: T, index: number, collection: List) => value is S; // Note: key should be string, not keyof T, because the actual object may contain extra properties that were not specified in the type. type ObjectIterator = (value: TObject[keyof TObject], key: string, collection: TObject) => TResult; type ObjectIteratee = ObjectIterator | IterateeShorthand; type ObjectIterateeCustom = ObjectIterator | IterateeShorthand; type ObjectIteratorTypeGuard = (value: TObject[keyof TObject], key: string, collection: TObject) => value is S; type StringIterator = (char: string, index: number, string: string) => TResult; /** @deprecated Use MemoVoidArrayIterator or MemoVoidDictionaryIterator instead. */ type MemoVoidIterator = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => void; /** @deprecated Use MemoListIterator or MemoObjectIterator instead. */ type MemoIterator = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => TResult; type MemoListIterator = (prev: TResult, curr: T, index: number, list: TList) => TResult; type MemoObjectIterator = (prev: TResult, curr: T, key: string, list: TList) => TResult; type MemoIteratorCapped = (prev: TResult, curr: T) => TResult; type MemoIteratorCappedRight = (curr: T, prev: TResult) => TResult; type MemoVoidArrayIterator = (acc: TResult, curr: T, index: number, arr: T[]) => void; type MemoVoidDictionaryIterator = (acc: TResult, curr: T, key: K, dict: Record) => void; type MemoVoidIteratorCapped = (acc: TResult, curr: T) => void; type ValueIteratee = ((value: T) => NotVoid) | IterateeShorthand; type ValueIterateeCustom = ((value: T) => TResult) | IterateeShorthand; type ValueIteratorTypeGuard = (value: T) => value is S; type ValueKeyIteratee = ((value: T, key: string) => NotVoid) | IterateeShorthand; type ValueKeyIterateeTypeGuard = (value: T, key: string) => value is S; type Comparator = (a: T, b: T) => boolean; type Comparator2 = (a: T1, b: T2) => boolean; type PropertyName = string | number | symbol; type PropertyPath = Many; /** Common interface between Arrays and jQuery objects */ type List = ArrayLike; interface Dictionary { [index: string]: T; } interface NumericDictionary { [index: number]: T; } // Crazy typedef needed get _.omit to work properly with Dictionary and NumericDictionary type AnyKindOfDictionary = | Dictionary | NumericDictionary; type PartialShallow = { [P in keyof T]?: T[P] extends object ? object : T[P] }; type StringToNumber = T extends `${infer N extends number}` ? N : never; // For backwards compatibility type LoDashImplicitArrayWrapper = LoDashImplicitWrapper; type LoDashImplicitNillableArrayWrapper = LoDashImplicitWrapper; type LoDashImplicitObjectWrapper = LoDashImplicitWrapper; type LoDashImplicitNillableObjectWrapper = LoDashImplicitWrapper; type LoDashImplicitNumberArrayWrapper = LoDashImplicitWrapper; type LoDashImplicitStringWrapper = LoDashImplicitWrapper; type LoDashExplicitArrayWrapper = LoDashExplicitWrapper; type LoDashExplicitNillableArrayWrapper = LoDashExplicitWrapper; type LoDashExplicitObjectWrapper = LoDashExplicitWrapper; type LoDashExplicitNillableObjectWrapper = LoDashExplicitWrapper; type LoDashExplicitNumberArrayWrapper = LoDashExplicitWrapper; type LoDashExplicitStringWrapper = LoDashExplicitWrapper; type DictionaryIterator = ObjectIterator, TResult>; type DictionaryIteratee = ObjectIteratee>; type DictionaryIteratorTypeGuard = ObjectIteratorTypeGuard, S>; // NOTE: keys of objects at run time are always strings, even when a NumericDictionary is being iterated. type NumericDictionaryIterator = (value: T, key: string, collection: NumericDictionary) => TResult; type NumericDictionaryIteratee = NumericDictionaryIterator | IterateeShorthand; type NumericDictionaryIterateeCustom = NumericDictionaryIterator | IterateeShorthand; }