UNPKG

243 kBTypeScriptView Raw
1// Type definitions for Underscore 1.11
2// Project: https://underscorejs.org/
3// Definitions by: Boris Yankov <https://github.com/borisyankov>,
4// Josh Baldwin <https://github.com/jbaldwin>,
5// Christopher Currens <https://github.com/ccurrens>,
6// Ard Timmerman <https://github.com/confususs>,
7// Julian Gonggrijp <https://github.com/jgonggrijp>,
8// Florian Imdahl <https://github.com/ffflorian>
9// Regev Brody <https://github.com/regevbr>
10// Piotr Błażejewicz <https://github.com/peterblazejewicz>
11// Michael Ness <https://github.com/reubenrybnik>
12// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
13// TypeScript Version: 2.8
14
15declare var _: _.UnderscoreStatic;
16export = _;
17export as namespace _;
18
19// The DOM is not required to be present, but these definitions reference type Element for the
20// isElement check. If the DOM is present, this declaration will merge.
21declare global {
22 interface Element { }
23}
24
25declare module _ {
26 /**
27 * underscore.js _.throttle options.
28 **/
29 interface ThrottleSettings {
30
31 /**
32 * If you'd like to disable the leading-edge call, pass this as false.
33 **/
34 leading?: boolean | undefined;
35
36 /**
37 * If you'd like to disable the execution on the trailing-edge, pass false.
38 **/
39 trailing?: boolean | undefined;
40 }
41
42 /**
43 * underscore.js template settings, set templateSettings or pass as an argument
44 * to 'template()' to override defaults.
45 **/
46 interface TemplateSettings {
47 /**
48 * Default value is '/<%([\s\S]+?)%>/g'.
49 **/
50 evaluate?: RegExp | undefined;
51
52 /**
53 * Default value is '/<%=([\s\S]+?)%>/g'.
54 **/
55 interpolate?: RegExp | undefined;
56
57 /**
58 * Default value is '/<%-([\s\S]+?)%>/g'.
59 **/
60 escape?: RegExp | undefined;
61
62 /**
63 * By default, 'template()' places the values from your data in the local scope via the 'with' statement.
64 * However, you can specify a single variable name with this setting.
65 **/
66 variable?: string | undefined;
67 }
68
69 interface CompiledTemplate {
70 (data?: any): string;
71 source: string;
72 }
73
74 // Common interface between Arrays and jQuery objects
75 interface List<T> {
76 [index: number]: T;
77 length: number;
78 }
79
80 interface Dictionary<T> {
81 [index: string]: T;
82 }
83
84 type Collection<T> = List<T> | Dictionary<T>;
85
86 type CollectionKey<V> =
87 V extends never ? any
88 : V extends List<any> ? number
89 : V extends Dictionary<any> ? string
90 : V extends undefined ? undefined
91 : never;
92
93 interface Predicate<T> {
94 (value: T): boolean;
95 }
96
97 interface CollectionIterator<T extends TypeOfList<V> | TypeOfDictionary<V, any>, TResult, V = Collection<T>> {
98 (element: T, key: CollectionKey<V>, collection: V): TResult;
99 }
100
101 interface ListIterator<T extends TypeOfList<V>, TResult, V = List<T>> extends CollectionIterator<T, TResult, V> { }
102
103 interface ObjectIterator<T extends TypeOfDictionary<V, any>, TResult, V = Dictionary<T>> extends CollectionIterator<T, TResult, V> { }
104
105 type Iteratee<V, R, T extends TypeOfCollection<V, any> = TypeOfCollection<V>> =
106 CollectionIterator<T, R, V> |
107 string | number |
108 (string | number)[] |
109 Partial<T> |
110 null |
111 undefined;
112
113 type IterateeResult<I, T> =
114 I extends (...args: any[]) => infer R ? R
115 : I extends keyof T ? T[I]
116 : I extends string | number | (string | number)[] ? any
117 : I extends object ? boolean
118 : I extends null | undefined ? T
119 : never;
120
121 type PropertyTypeOrAny<T, K> = K extends keyof T ? T[K] : any;
122
123 interface MemoCollectionIterator<T extends TypeOfList<V> | TypeOfDictionary<V, any>, TResult, V = Collection<T>> {
124 (prev: TResult, curr: T, key: CollectionKey<V>, collection: V): TResult;
125 }
126
127 interface MemoIterator<T extends TypeOfList<V>, TResult, V = List<T>> extends MemoCollectionIterator<T, TResult, V> { }
128
129 interface MemoObjectIterator<T extends TypeOfDictionary<V>, TResult, V = Dictionary<T>> extends MemoCollectionIterator<T, TResult, V> { }
130
131 type TypeOfList<V> =
132 V extends never ? any
133 : V extends List<infer T> ? T
134 : never;
135
136 type TypeOfDictionary<V, TDefault = never> =
137 V extends never ? any
138 : V extends Dictionary<infer T> ? T
139 : TDefault;
140
141 type TypeOfCollection<V, TObjectDefault = never> = V extends List<any> ? TypeOfList<V> : TypeOfDictionary<V, TObjectDefault>;
142
143 type ListItemOrSelf<T> = T extends List<infer TItem> ? TItem : T;
144
145 // unfortunately it's not possible to recursively collapse all possible list dimensions to T[] at this time,
146 // so give up after one dimension since that's likely the most common case
147 // '& object' prevents strings from being matched by list checks so types like string[] don't end up resulting in any
148 type DeepestListItemOrSelf<T> =
149 T extends List<infer TItem> & object
150 ? TItem extends List<any> & object
151 ? any
152 : TItem
153 : T;
154
155 // if T is an inferrable pair, the value type for the pair
156 // if T is a list, assume that it contains pairs of some type, so any
157 // if T isn't a list, there's no way that it can provide pairs, so never
158 type PairValue<T> =
159 T extends Readonly<[string | number, infer TValue]> ? TValue
160 : T extends List<infer TValue> ? TValue
161 : never;
162
163 type AnyFalsy = undefined | null | false | '' | 0;
164
165 type Truthy<T> = Exclude<T, AnyFalsy>;
166
167 type _Pick<V, K extends string> =
168 Extract<K, keyof V> extends never ? Partial<V>
169 : Pick<V, Extract<K, keyof V>>;
170
171 // switch to Omit when the minimum TS version moves past 3.5
172 type _Omit<V, K extends string> =
173 V extends never ? any
174 : Extract<K, keyof V> extends never ? Partial<V>
175 : Pick<V, Exclude<keyof V, K>>;
176
177 type _ChainSingle<V> = _Chain<TypeOfCollection<V>, V>;
178
179 type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
180
181 interface Cancelable {
182 cancel(): void;
183 }
184
185 interface UnderscoreStatic {
186 /*******
187 * OOP *
188 *******/
189
190 /**
191 * Underscore OOP Wrapper, all Underscore functions that take an object
192 * as the first parameter can be invoked through this function.
193 * @param value First argument to Underscore object functions.
194 * @returns An Underscore wrapper around the supplied value.
195 **/
196 <V>(value: V): Underscore<TypeOfCollection<V>, V>;
197
198 /***************
199 * Collections *
200 ***************/
201
202 /**
203 * Iterates over a `collection` of elements, yielding each in turn to
204 * an `iteratee`. The `iteratee` is bound to the context object, if one
205 * is passed.
206 * @param collection The collection of elements to iterate over.
207 * @param iteratee The iteratee to call for each element in
208 * `collection`.
209 * @param context 'this' object in `iteratee`, optional.
210 * @returns The original collection.
211 **/
212 each<V extends Collection<any>>(
213 collection: V,
214 iteratee: CollectionIterator<TypeOfCollection<V>, void, V>,
215 context?: any
216 ): V;
217
218 /**
219 * @see each
220 **/
221 forEach: UnderscoreStatic['each'];
222
223 /**
224 * Produces a new array of values by mapping each value in `collection`
225 * through a transformation `iteratee`.
226 * @param collection The collection to transform.
227 * @param iteratee The iteratee to use to transform each item in
228 * `collection`.
229 * @param context `this` object in `iteratee`, optional.
230 * @returns The mapped result.
231 **/
232 map<V extends Collection<any>, I extends Iteratee<V, any>>(
233 collection: V,
234 iteratee: I,
235 context?: any
236 ): IterateeResult<I, TypeOfCollection<V>>[];
237
238 /**
239 * @see map
240 **/
241 collect: UnderscoreStatic['map'];
242
243 /**
244 * Also known as inject and foldl, reduce boils down a `collection` of
245 * values into a single value. `memo` is the initial state of the
246 * reduction, and each successive step of it should be returned by
247 * `iteratee`.
248 *
249 * If no memo is passed to the initial invocation of reduce, `iteratee`
250 * is not invoked on the first element of `collection`. The first
251 * element is instead passed as the memo in the invocation of
252 * `iteratee` on the next element in `collection`.
253 * @param collection The collection to reduce.
254 * @param iteratee The function to call on each iteration to reduce the
255 * collection.
256 * @param memo The initial reduce state or undefined to use the first
257 * item in `collection` as initial state.
258 * @param context `this` object in `iteratee`, optional.
259 * @returns The reduced result.
260 **/
261 reduce<V extends Collection<any>, TResult>(
262 collection: V,
263 iteratee: MemoCollectionIterator<TypeOfCollection<V>, TResult, V>,
264 memo: TResult,
265 context?: any
266 ): TResult;
267 reduce<V extends Collection<any>, TResult = TypeOfCollection<V>>(
268 collection: V,
269 iteratee: MemoCollectionIterator<TypeOfCollection<V>,
270 TResult | TypeOfCollection<V>,
271 V>
272 ): TResult | TypeOfCollection<V> | undefined;
273
274 /**
275 * @see reduce
276 **/
277 inject: UnderscoreStatic['reduce'];
278
279 /**
280 * @see reduce
281 **/
282 foldl: UnderscoreStatic['reduce'];
283
284 /**
285 * The right-associative version of reduce.
286 *
287 * This is not as useful in JavaScript as it would be in a language
288 * with lazy evaluation.
289 * @param collection The collection to reduce.
290 * @param iteratee The function to call on each iteration to reduce the
291 * collection.
292 * @param memo The initial reduce state or undefined to use the first
293 * item in `collection` as the initial state.
294 * @param context `this` object in `iteratee`, optional.
295 * @returns The reduced result.
296 **/
297 reduceRight<V extends Collection<any>, TResult>(
298 collection: V,
299 iteratee: MemoCollectionIterator<TypeOfCollection<V>, TResult, V>,
300 memo: TResult,
301 context?: any
302 ): TResult;
303 reduceRight<V extends Collection<any>, TResult = TypeOfCollection<V>>(
304 collection: V,
305 iteratee: MemoCollectionIterator<TypeOfCollection<V>,
306 TResult | TypeOfCollection<V>,
307 V>
308 ): TResult | TypeOfCollection<V> | undefined;
309
310 /**
311 * @see reduceRight
312 **/
313 foldr: UnderscoreStatic['reduceRight'];
314
315 /**
316 * Looks through each value in `collection`, returning the first one
317 * that passes a truth test (`iteratee`), or undefined if no value
318 * passes the test. The function returns as soon as it finds an
319 * acceptable element, and doesn't traverse the entire collection.
320 * @param collection The collection to search.
321 * @param iteratee The truth test to apply.
322 * @param context `this` object in `iteratee`, optional.
323 * @returns The first element in `collection` that passes the truth
324 * test or undefined if no elements pass.
325 **/
326 find<V extends Collection<any>>(
327 collection: V,
328 iteratee?: Iteratee<V, boolean>,
329 context?: any
330 ): TypeOfCollection<V> | undefined;
331
332 /**
333 * @see find
334 **/
335 detect: UnderscoreStatic['find'];
336
337 /**
338 * Looks through each value in `collection`, returning an array of
339 * all the values that pass a truth test (`iteratee`).
340 * @param collection The collection to filter.
341 * @param iteratee The truth test to apply.
342 * @param context `this` object in `iteratee`, optional.
343 * @returns The set of values that pass the truth test.
344 **/
345 filter<V extends Collection<any>>(
346 collection: V,
347 iteratee?: Iteratee<V, boolean>,
348 context?: any
349 ): TypeOfCollection<V>[];
350
351 /**
352 * @see filter
353 **/
354 select: UnderscoreStatic['filter'];
355
356 /**
357 * Looks through each value in `collection`, returning an array of all
358 * the elements that match the key-value pairs listed in `properties`.
359 * @param collection The collection in which to find elements that
360 * match `properties`.
361 * @param properties The properties to check for on the elements within
362 * `collection`.
363 * @returns The elements in `collection` that match `properties`.
364 **/
365 where<V extends Collection<any>>(
366 collection: V,
367 properties: Partial<TypeOfCollection<V>>
368 ): TypeOfCollection<V>[];
369
370 /**
371 * Looks through `collection` and returns the first value that matches
372 * all of the key-value pairs listed in `properties`. If no match is
373 * found, or if list is empty, undefined will be returned.
374 * @param collection The collection in which to find an element that
375 * matches `properties`.
376 * @param properties The properties to check for on the elements within
377 * `collection`.
378 * @returns The first element in `collection` that matches `properties`
379 * or undefined if no match is found.
380 **/
381 findWhere<V extends Collection<any>>(
382 collection: V,
383 properties: Partial<TypeOfCollection<V>>
384 ): TypeOfCollection<V> | undefined;
385
386 /**
387 * Returns the values in `collection` without the elements that pass a
388 * truth test (`iteratee`).
389 * The opposite of filter.
390 * @param collection The collection to filter.
391 * @param iteratee The truth test to apply.
392 * @param context `this` object in `iteratee`, optional.
393 * @returns The set of values that fail the truth test.
394 **/
395 reject<V extends Collection<any>>(
396 collection: V,
397 iteratee?: Iteratee<V, boolean>,
398 context?: any
399 ): TypeOfCollection<V>[];
400
401 /**
402 * Returns true if all of the values in `collection` pass the
403 * `iteratee` truth test. Short-circuits and stops traversing
404 * `collection` if a false element is found.
405 * @param collection The collection to evaluate.
406 * @param iteratee The truth test to apply.
407 * @param context `this` object in `iteratee`, optional.
408 * @returns True if all elements pass the truth test, otherwise false.
409 **/
410 every<V extends Collection<any>>(
411 collection: V,
412 iteratee?: Iteratee<V, boolean>,
413 context?: any
414 ): boolean;
415
416 /**
417 * @see every
418 **/
419 all: UnderscoreStatic['every'];
420
421 /**
422 * Returns true if any of the values in `collection` pass the
423 * `iteratee` truth test. Short-circuits and stops traversing
424 * `collection` if a true element is found.
425 * @param collection The collection to evaluate.
426 * @param iteratee The truth test to apply.
427 * @param context `this` object in `iteratee`, optional.
428 * @returns True if any element passed the truth test, otherwise false.
429 **/
430 some<V extends Collection<any>>(
431 collection: V,
432 iteratee?: Iteratee<V, boolean>,
433 context?: any
434 ): boolean;
435
436 /**
437 * @see some
438 **/
439 any: UnderscoreStatic['some'];
440
441 /**
442 * Returns true if the value is present in `collection`. Uses indexOf
443 * internally, if `collection` is a List. Use `fromIndex` to start your
444 * search at a given index.
445 * @param collection The collection to check for `value`.
446 * @param value The value to check `collection` for.
447 * @param fromIndex The index to start searching from, optional,
448 * default = 0, only used when `collection` is a List.
449 * @returns True if `value` is present in `collection` after
450 * `fromIndex`, otherwise false.
451 **/
452 contains<V extends Collection<any>>(
453 collection: V,
454 value: any,
455 fromIndex?: number
456 ): boolean;
457
458 /**
459 * @see contains
460 **/
461 include: UnderscoreStatic['contains'];
462
463 /**
464 * @see contains
465 **/
466 includes: UnderscoreStatic['contains'];
467
468 /**
469 * Calls the method named by `methodName` on each value in
470 * `collection`. Any extra arguments passed to invoke will be forwarded
471 * on to the method invocation.
472 * @param collection The collection of elements to invoke `methodName`
473 * on.
474 * @param methodName The name of the method to call on each element in
475 * `collection`.
476 * @param args Additional arguments to pass to method `methodName`.
477 * @returns An array containing the result of the method call for each
478 * item in `collection`.
479 **/
480 invoke(
481 list: Collection<any>,
482 methodName: string,
483 ...args: any[]
484 ): any[];
485
486 /**
487 * A convenient version of what is perhaps the most common use-case for
488 * map: extracting a list of property values.
489 * @param collection The collection of items.
490 * @param propertyName The name of a specific property to retrieve from
491 * all items in `collection`.
492 * @returns The set of values for the specified `propertyName` for each
493 * item in `collection`.
494 **/
495 pluck<V extends Collection<any>, K extends string | number>(
496 collection: V,
497 propertyName: K
498 ): PropertyTypeOrAny<TypeOfCollection<V>, K>[];
499
500 /**
501 * Returns the maximum value in `collection`. If an `iteratee` is
502 * provided, it will be used on each element to generate the criterion
503 * by which the element is ranked. -Infinity is returned if list is
504 * empty. Non-numerical values returned by `iteratee` will be ignored.
505 * @param collection The collection in which to find the maximum value.
506 * @param iteratee The iteratee that provides the criterion by which
507 * each element is ranked, optional if evaluating a collection of
508 * numbers.
509 * @param context `this` object in `iteratee`, optional.
510 * @returns The maximum element within `collection` or -Infinity if
511 * `collection` is empty.
512 **/
513 max<V extends Collection<any>>(
514 collection: V,
515 iteratee?: Iteratee<V, any>,
516 context?: any
517 ): TypeOfCollection<V> | number;
518
519 /**
520 * Returns the minimum value in `collection`. If an `iteratee` is
521 * provided, it will be used on each element to generate the criterion
522 * by which the element is ranked. Infinity is returned if list is
523 * empty. Non-numerical values returned by `iteratee` will be ignored.
524 * @param collection The collection in which to find the minimum value.
525 * @param iteratee The iteratee that provides the criterion by which
526 * each element is ranked, optional if evaluating a collection of
527 * numbers.
528 * @param context `this` object in `iteratee`, optional.
529 * @returns The minimum element within `collection` or Infinity if
530 * `collection` is empty.
531 **/
532 min<V extends Collection<any>>(
533 list: V,
534 iteratee?: Iteratee<V, any>,
535 context?: any
536 ): TypeOfCollection<V> | number;
537
538 /**
539 * Returns a (stably) sorted copy of `collection`, ranked in ascending
540 * order by the results of running each value through `iteratee`.
541 * @param collection The collection to sort.
542 * @param iteratee An iteratee that provides the value to sort by for
543 * each item in `collection`.
544 * @param context `this` object in `iteratee`, optional.
545 * @returns A sorted copy of `collection`.
546 **/
547 sortBy<V extends Collection<any>>(
548 collection: V,
549 iteratee?: Iteratee<V, any>,
550 context?: any): TypeOfCollection<V>[];
551
552 /**
553 * Splits `collection` into sets that are grouped by the result of
554 * running each value through `iteratee`.
555 * @param collection The collection to group.
556 * @param iteratee An iteratee that provides the value to group by for
557 * each item in `collection`.
558 * @param context `this` object in `iteratee`, optional.
559 * @returns A dictionary with the group names provided by `iteratee` as
560 * properties where each property contains the grouped elements from
561 * `collection`.
562 **/
563 groupBy<V extends Collection<any>>(
564 collection: V,
565 iteratee?: Iteratee<V, string | number>,
566 context?: any
567 ): Dictionary<TypeOfCollection<V>[]>;
568
569 /**
570 * Given a `collection` and an `iteratee` function that returns a key
571 * for each element in `collection`, returns an object that acts as an
572 * index of each item. Just like `groupBy`, but for when you know your
573 * keys are unique.
574 * @param collection The collection to index.
575 * @param iteratee An iteratee that provides the value to index by for
576 * each item in `collection`.
577 * @param context `this` object in `iteratee`, optional.
578 * @returns A dictionary where each item in `collection` is assigned to
579 * the property designated by `iteratee`.
580 **/
581 indexBy<V extends Collection<any>>(
582 collection: V,
583 iteratee?: Iteratee<V, string | number>,
584 context?: any): Dictionary<TypeOfCollection<V>>;
585
586 /**
587 * Sorts `collection` into groups and returns a count for the number of
588 * objects in each group. Similar to `groupBy`, but instead of
589 * returning a list of values, returns a count for the number of values
590 * in that group.
591 * @param collection The collection to count.
592 * @param iteratee An iteratee that provides the value to count by for
593 * each item in `collection`.
594 * @param context `this` object in `iteratee`, optional.
595 * @returns A dictionary with the group names provided by `iteratee` as
596 * properties where each property contains the count of the grouped
597 * elements from `collection`.
598 **/
599 countBy<V extends Collection<any>>(
600 collection: V,
601 iteratee?: Iteratee<V, string | number>,
602 context?: any
603 ): Dictionary<number>;
604
605 /**
606 * Returns a shuffled copy of `collection`, using a version of the
607 * Fisher-Yates shuffle.
608 * @param collection The collection to shuffle.
609 * @returns A shuffled copy of `collection`.
610 **/
611 shuffle<V extends Collection<any>>(
612 collection: V
613 ): TypeOfCollection<V>[];
614
615 /**
616 * Produce a random sample from `collection`. Pass a number to return
617 * `n` random elements from `collection`. Otherwise a single random
618 * item will be returned.
619 * @param collection The collection to sample.
620 * @param n The number of elements to sample from `collection`.
621 * @returns A random sample of `n` elements from `collection` or a
622 * single element if `n` is not specified.
623 **/
624 sample<V extends Collection<any>>(
625 collection: V,
626 n: number
627 ): TypeOfCollection<V>[];
628 sample<V extends Collection<any>>(
629 collection: V
630 ): TypeOfCollection<V> | undefined;
631
632 /**
633 * Creates a real Array from `collection` (anything that can be
634 * iterated over). Useful for transmuting the arguments object.
635 * @param collection The collection to transform into an array.
636 * @returns An array containing the elements of `collection`.
637 **/
638 toArray<V extends Collection<any>>(
639 collection: V
640 ): TypeOfCollection<V>[];
641
642 /**
643 * Determines the number of values in `collection`.
644 * @param collection The collection to determine the number of values
645 * for.
646 * @returns The number of values in `collection`.
647 **/
648 size(collection: Collection<any>): number;
649
650 /**
651 * Splits `collection` into two arrays: one whose elements all satisfy
652 * `iteratee` and one whose elements all do not satisfy `iteratee`.
653 * @param collection The collection to partition.
654 * @param iteratee The iteratee that defines the partitioning scheme
655 * for each element in `collection`.
656 * @param context `this` object in `iteratee`, optional.
657 * @returns An array composed of two elements, where the first element
658 * contains the elements in `collection` that satisfied the predicate
659 * and the second element contains the elements that did not.
660 **/
661 partition<V extends Collection<any>>(
662 list: V,
663 iteratee?: Iteratee<V, boolean>,
664 context?: any
665 ): [TypeOfCollection<V>[], TypeOfCollection<V>[]];
666
667 /**********
668 * Arrays *
669 **********/
670
671 /**
672 * Returns the first element of `list`. Passing `n` will return the
673 * first `n` elements of `list`.
674 * @param list The list to retrieve elements from.
675 * @param n The number of elements to retrieve, optional.
676 * @returns The first `n` elements of `list` or the first element if
677 * `n` is omitted.
678 **/
679 first<V extends List<any>>(
680 list: V
681 ): TypeOfList<V> | undefined;
682 first<V extends List<any>>(
683 list: V,
684 n: number
685 ): TypeOfList<V>[];
686
687 /**
688 * @see first
689 **/
690 head: UnderscoreStatic['first'];
691
692 /**
693 * @see first
694 **/
695 take: UnderscoreStatic['first'];
696
697 /**
698 * Returns everything but the last entry of `list`. Especially useful
699 * on the arguments object. Pass `n` to exclude the last
700 * `n` elements from the result.
701 * @param list The list to retrieve elements from.
702 * @param n The number of elements from the end of `list` to omit,
703 * optional, default = 1.
704 * @returns The elements of `list` with the last `n` items omitted.
705 **/
706 initial<V extends List<any>>(
707 list: V,
708 n?: number
709 ): TypeOfList<V>[];
710
711 /**
712 * Returns the last element of `list`. Passing `n` will return the last
713 * `n` elements of `list`.
714 * @param list The list to retrieve elements from.
715 * @param n The number of elements to retrieve, optional.
716 * @returns The last `n` elements of `list` or the last element if `n`
717 * is omitted.
718 **/
719 last<V extends List<any>>(
720 list: V
721 ): TypeOfList<V> | undefined;
722 last<V extends List<any>>(
723 list: V,
724 n: number
725 ): TypeOfList<V>[];
726
727 /**
728 * Returns the rest of the elements in `list`. Pass an `index` to
729 * return the values of the list from that index onward.
730 * @param list The list to retrieve elements from.
731 * @param index The index to start retrieving elements from, optional,
732 * default = 1.
733 * @returns The elements of `list` from `index` to the end of the list.
734 **/
735 rest<V extends List<any>>(
736 list: V,
737 index?: number
738 ): TypeOfList<V>[];
739
740 /**
741 * @see rest
742 **/
743 tail: UnderscoreStatic['rest'];
744
745 /**
746 * @see rest
747 **/
748 drop: UnderscoreStatic['rest'];
749
750 /**
751 * Returns a copy of `list` with all falsy values removed. In
752 * JavaScript, false, null, 0, "", undefined and NaN are all falsy.
753 * @param list The list to compact.
754 * @returns An array containing the elements of `list` without falsy
755 * values.
756 **/
757 compact<V extends List<any> | null | undefined>(
758 list: V
759 ): Truthy<TypeOfList<V>>[];
760
761 /**
762 * Flattens a nested `list` (the nesting can be to any depth). If you
763 * pass true or 1 as the depth, the `list` will only be flattened a
764 * single level. Passing a greater number will cause the flattening to
765 * descend deeper into the nesting hierarchy. Omitting the depth
766 * argument, or passing false or Infinity, flattens the `list` all the
767 * way to the deepest nesting level.
768 * @param list The list to flatten.
769 * @param depth True to only flatten one level, optional,
770 * default = false.
771 * @returns The flattened `list`.
772 **/
773 flatten<V extends List<any>>(
774 list: V,
775 depth: 1 | true
776 ): ListItemOrSelf<TypeOfList<V>>[];
777 flatten<V extends List<any>>(
778 list: V,
779 depth?: number | false
780 ): DeepestListItemOrSelf<TypeOfList<V>>[];
781
782 /**
783 * Returns a copy of `list` with all instances of `values` removed.
784 * @param list The list to exclude `values` from.
785 * @param values The values to exclude from `list`.
786 * @returns An array that contains all elements of `list` except for
787 * `values`.
788 **/
789 without<V extends List<any>>(
790 list: V,
791 ...values: TypeOfList<V>[]
792 ): TypeOfList<V>[];
793
794 /**
795 * Computes the union of the passed-in `lists`: the list of unique
796 * items, examined in order from first list to last list, that are
797 * present in one or more of the lists.
798 * @param lists The lists to compute the union of.
799 * @returns The union of elements within `lists`.
800 **/
801 union<T>(...lists: List<T>[]): T[];
802
803 /**
804 * Computes the list of values that are the intersection of the
805 * passed-in `lists`. Each value in the result is present in each of
806 * the lists.
807 * @param lists The lists to compute the intersection of.
808 * @returns The intersection of elements within the `lists`.
809 **/
810 intersection<T>(...lists: List<T>[]): T[];
811
812 /**
813 * Similar to without, but returns the values from `list` that are not
814 * present in `others`.
815 * @param list The starting list.
816 * @param others The lists of values to exclude from `list`.
817 * @returns The contents of `list` without the values in `others`.
818 **/
819 difference<T>(
820 list: List<T>,
821 ...others: List<T>[]
822 ): T[];
823
824 /**
825 * Produces a duplicate-free version of `list`, using === to test
826 * object equality. If you know in advance that `list` is sorted,
827 * passing true for isSorted will run a much faster algorithm. If you
828 * want to compute unique items based on a transformation, pass an
829 * iteratee function.
830 * @param list The list to remove duplicates from.
831 * @param isSorted True if `list` is already sorted, optional,
832 * default = false.
833 * @param iteratee Transform the elements of `list` before comparisons
834 * for uniqueness.
835 * @param context 'this' object in `iteratee`, optional.
836 * @returns An array containing only the unique elements in `list`.
837 **/
838 uniq<V extends List<any>>(
839 list: V,
840 isSorted?: boolean,
841 iteratee?: Iteratee<V, any>,
842 context?: any
843 ): TypeOfList<V>[];
844 uniq<V extends List<any>>(
845 list: V,
846 iteratee?: Iteratee<V, any>,
847 context?: any
848 ): TypeOfList<V>[];
849
850 /**
851 * @see uniq
852 **/
853 unique: UnderscoreStatic['uniq'];
854
855 /**
856 * Merges together the values of each of the `lists` with the values at
857 * the corresponding position. Useful when you have separate data
858 * sources that are coordinated through matching list indexes.
859 * @param lists The lists to zip.
860 * @returns The zipped version of `lists`.
861 **/
862 zip(...lists: List<any>[]): any[][];
863
864 /**
865 * The opposite of zip. Given a list of lists, returns a series of new
866 * arrays, the first of which contains all of the first elements in the
867 * input lists, the second of which contains all of the second
868 * elements, and so on. (alias: transpose)
869 * @param lists The lists to unzip.
870 * @returns The unzipped version of `lists`.
871 **/
872 unzip(lists: List<List<any>>): any[][];
873 transpose(lists: List<List<any>>): any[][];
874
875 /**
876 * Converts lists into objects. Pass either a single `list` of
877 * [key, value] pairs, or a `list` of keys and a list of `values`.
878 * Passing by pairs is the reverse of pairs. If duplicate keys exist,
879 * the last value wins.
880 * @param list A list of [key, value] pairs or a list of keys.
881 * @param values If `list` is a list of keys, a list of values
882 * corresponding to those keys.
883 * @returns An object comprised of the provided keys and values.
884 **/
885 object<TList extends List<string | number>, TValue>(
886 list: TList,
887 values: List<TValue>
888 ): Dictionary<TValue | undefined>;
889 object<TList extends List<List<any>>>(
890 list: TList
891 ): Dictionary<PairValue<TypeOfList<TList>>>;
892
893 /**
894 * Returns the index at which `value` can be found in `list`, or -1 if
895 * `value` is not present. If you're working with a large list and you
896 * know that the list is already sorted, pass true for
897 * `isSortedOrFromIndex` to use a faster binary search...or, pass a
898 * number in order to look for the first matching value in the list
899 * after the given index.
900 * @param list The list to search for the index of `value`.
901 * @param value The value to search for within `list`.
902 * @param isSortedOrFromIndex True if `list` is already sorted OR the
903 * starting index for the search, optional.
904 * @returns The index of the first occurrence of `value` within `list`
905 * or -1 if `value` is not found.
906 **/
907 indexOf<V extends List<any>>(
908 list: V,
909 value: TypeOfList<V>,
910 isSortedOrFromIndex?: boolean | number
911 ): number;
912
913 /**
914 * Returns the index of the last occurrence of `value` in `list`, or -1
915 * if `value` is not present. Pass `fromIndex` to start your search at
916 * a given index.
917 * @param list The list to search for the last occurrence of `value`.
918 * @param value The value to search for within `list`.
919 * @param fromIndex The starting index for the search, optional.
920 * @returns The index of the last occurrence of `value` within `list`
921 * or -1 if `value` is not found.
922 **/
923 lastIndexOf<V extends List<any>>(
924 list: V,
925 value: TypeOfList<V>,
926 fromIndex?: number
927 ): number;
928
929 /**
930 * Returns the first index of an element in `list` where the `iteratee`
931 * truth test passes, otherwise returns -1.
932 * @param list The list to search for the index of the first element
933 * that passes the truth test.
934 * @param iteratee The truth test to apply.
935 * @param context `this` object in `iteratee`, optional.
936 * @returns The index of the first element in `list` where the
937 * truth test passes or -1 if no elements pass.
938 **/
939 findIndex<V extends List<any>>(
940 list: V,
941 iteratee?: Iteratee<V, boolean>,
942 context?: any
943 ): number;
944
945 /**
946 * Returns the last index of an element in `list` where the `iteratee`
947 * truth test passes, otherwise returns -1.
948 * @param list The list to search for the index of the last element
949 * that passes the truth test.
950 * @param iteratee The truth test to apply.
951 * @param context `this` object in `iteratee`, optional.
952 * @returns The index of the last element in `list` where the
953 * truth test passes or -1 if no elements pass.
954 **/
955 findLastIndex<V extends List<any>>(
956 list: V,
957 iteratee?: Iteratee<V, boolean>,
958 context?: any
959 ): number;
960
961 /**
962 * Uses a binary search to determine the lowest index at which the
963 * value should be inserted into `list` in order to maintain `list`'s
964 * sorted order. If an iteratee is provided, it will be used to compute
965 * the sort ranking of each value, including the value you pass.
966 * @param list A sorted list.
967 * @param value The value to determine an insert index for to mainain
968 * the sorting in `list`.
969 * @param iteratee Iteratee to compute the sort ranking of each
970 * element including `value`, optional.
971 * @param context `this` object in `iteratee`, optional.
972 * @returns The index where `value` should be inserted into `list`.
973 **/
974 sortedIndex<V extends List<any>>(
975 list: V,
976 value: TypeOfList<V>,
977 iteratee?: Iteratee<V | undefined, any>,
978 context?: any
979 ): number;
980
981 /**
982 * A function to create flexibly-numbered lists of integers, handy for
983 * `each` and `map` loops. Returns a list of integers from
984 * `startOrStop` (inclusive) to `stop` (exclusive), incremented
985 * (or decremented) by `step`. Note that ranges that `stop` before they
986 * `start` are considered to be zero-length instead of negative - if
987 * you'd like a negative range, use a negative `step`.
988 *
989 * If `stop` is not specified, `startOrStop` will be the number to stop
990 * at and the default start of 0 will be used.
991 * @param startOrStop If `stop` is specified, the number to start at.
992 * Otherwise, this is the number to stop at and the default start of 0
993 * will be used.
994 * @param stop The number to stop at.
995 * @param step The number to count up by each iteration, optional,
996 * default = 1.
997 * @returns An array of numbers from start to `stop` with increments
998 * of `step`.
999 **/
1000 range(
1001 startOrStop: number,
1002 stop?: number,
1003 step?: number
1004 ): number[];
1005
1006 /**
1007 * Chunks `list` into multiple arrays, each containing `length` or
1008 * fewer items.
1009 * @param list The list to chunk.
1010 * @param length The maximum size of the chunks.
1011 * @returns The contents of `list` in chunks no greater than `length`
1012 * in size.
1013 **/
1014 chunk<V extends List<any>>(list: V, length: number): TypeOfList<V>[][]
1015
1016 /*************
1017 * Functions *
1018 *************/
1019
1020 /**
1021 * Bind a function to an object, meaning that whenever the function is called, the value of this will
1022 * be the object. Optionally, bind arguments to the function to pre-fill them, also known as partial application.
1023 * @param func The function to bind `this` to `object`.
1024 * @param context The `this` pointer whenever `fn` is called.
1025 * @param arguments Additional arguments to pass to `fn` when called.
1026 * @return `fn` with `this` bound to `object`.
1027 **/
1028 bind(
1029 func: Function,
1030 context: any,
1031 ...args: any[]): () => any;
1032
1033 /**
1034 * Binds a number of methods on the object, specified by methodNames, to be run in the context of that object
1035 * whenever they are invoked. Very handy for binding functions that are going to be used as event handlers,
1036 * which would otherwise be invoked with a fairly useless this. If no methodNames are provided, all of the
1037 * object's function properties will be bound to it.
1038 * @param object The object to bind the methods `methodName` to.
1039 * @param methodNames The methods to bind to `object`, optional and if not provided all of `object`'s
1040 * methods are bound.
1041 **/
1042 bindAll(
1043 object: any,
1044 ...methodNames: string[]): any;
1045
1046 /**
1047 * Partially apply a function by filling in any number of its arguments, without changing its dynamic this value.
1048 * A close cousin of bind. You may pass _ in your list of arguments to specify an argument that should not be
1049 * pre-filled, but left open to supply at call-time.
1050 * @param fn Function to partially fill in arguments.
1051 * @param arguments The partial arguments.
1052 * @return `fn` with partially filled in arguments.
1053 **/
1054
1055 partial<T1, T2>(
1056 fn: { (p1: T1): T2 },
1057 p1: T1
1058 ): { (): T2 };
1059
1060 partial<T1, T2, T3>(
1061 fn: { (p1: T1, p2: T2): T3 },
1062 p1: T1
1063 ): { (p2: T2): T3 };
1064
1065 partial<T1, T2, T3>(
1066 fn: { (p1: T1, p2: T2): T3 },
1067 p1: T1,
1068 p2: T2
1069 ): { (): T3 };
1070
1071 partial<T1, T2, T3>(
1072 fn: { (p1: T1, p2: T2): T3 },
1073 stub1: UnderscoreStatic,
1074 p2: T2
1075 ): { (p1: T1): T3 };
1076
1077 partial<T1, T2, T3, T4>(
1078 fn: { (p1: T1, p2: T2, p3: T3): T4 },
1079 p1: T1
1080 ): { (p2: T2, p3: T3): T4 };
1081
1082 partial<T1, T2, T3, T4>(
1083 fn: { (p1: T1, p2: T2, p3: T3): T4 },
1084 p1: T1,
1085 p2: T2
1086 ): { (p3: T3): T4 };
1087
1088 partial<T1, T2, T3, T4>(
1089 fn: { (p1: T1, p2: T2, p3: T3): T4 },
1090 stub1: UnderscoreStatic,
1091 p2: T2
1092 ): { (p1: T1, p3: T3): T4 };
1093
1094 partial<T1, T2, T3, T4>(
1095 fn: { (p1: T1, p2: T2, p3: T3): T4 },
1096 p1: T1,
1097 p2: T2,
1098 p3: T3
1099 ): { (): T4 };
1100
1101 partial<T1, T2, T3, T4>(
1102 fn: { (p1: T1, p2: T2, p3: T3): T4 },
1103 stub1: UnderscoreStatic,
1104 p2: T2,
1105 p3: T3
1106 ): { (p1: T1): T4 };
1107
1108 partial<T1, T2, T3, T4>(
1109 fn: { (p1: T1, p2: T2, p3: T3): T4 },
1110 p1: T1,
1111 stub2: UnderscoreStatic,
1112 p3: T3
1113 ): { (p2: T2): T4 };
1114
1115 partial<T1, T2, T3, T4>(
1116 fn: { (p1: T1, p2: T2, p3: T3): T4 },
1117 stub1: UnderscoreStatic,
1118 stub2: UnderscoreStatic,
1119 p3: T3
1120 ): { (p1: T1, p2: T2): T4 };
1121
1122 partial<T1, T2, T3, T4, T5>(
1123 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1124 p1: T1
1125 ): { (p2: T2, p3: T3, p4: T4): T5 };
1126
1127 partial<T1, T2, T3, T4, T5>(
1128 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1129 p1: T1,
1130 p2: T2
1131 ): { (p3: T3, p4: T4): T5 };
1132
1133 partial<T1, T2, T3, T4, T5>(
1134 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1135 stub1: UnderscoreStatic,
1136 p2: T2
1137 ): { (p1: T1, p3: T3, p4: T4): T5 };
1138
1139 partial<T1, T2, T3, T4, T5>(
1140 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1141 p1: T1,
1142 p2: T2,
1143 p3: T3
1144 ): { (p4: T4): T5 };
1145
1146 partial<T1, T2, T3, T4, T5>(
1147 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1148 stub1: UnderscoreStatic,
1149 p2: T2,
1150 p3: T3
1151 ): { (p1: T1, p4: T4): T5 };
1152
1153 partial<T1, T2, T3, T4, T5>(
1154 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1155 p1: T1,
1156 stub2: UnderscoreStatic,
1157 p3: T3
1158 ): { (p2: T2, p4: T4): T5 };
1159
1160 partial<T1, T2, T3, T4, T5>(
1161 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1162 stub1: UnderscoreStatic,
1163 stub2: UnderscoreStatic,
1164 p3: T3
1165 ): { (p1: T1, p2: T2, p4: T4): T5 };
1166
1167 partial<T1, T2, T3, T4, T5>(
1168 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1169 p1: T1,
1170 p2: T2,
1171 p3: T3,
1172 p4: T4
1173 ): { (): T5 };
1174
1175 partial<T1, T2, T3, T4, T5>(
1176 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1177 stub1: UnderscoreStatic,
1178 p2: T2,
1179 p3: T3,
1180 p4: T4
1181 ): { (p1: T1): T5 };
1182
1183 partial<T1, T2, T3, T4, T5>(
1184 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1185 p1: T1,
1186 stub2: UnderscoreStatic,
1187 p3: T3,
1188 p4: T4
1189 ): { (p2: T2): T5 };
1190
1191 partial<T1, T2, T3, T4, T5>(
1192 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1193 stub1: UnderscoreStatic,
1194 stub2: UnderscoreStatic,
1195 p3: T3,
1196 p4: T4
1197 ): { (p1: T1, p2: T2): T5 };
1198
1199 partial<T1, T2, T3, T4, T5>(
1200 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1201 p1: T1,
1202 p2: T2,
1203 stub3: UnderscoreStatic,
1204 p4: T4
1205 ): { (p3: T3): T5 };
1206
1207 partial<T1, T2, T3, T4, T5>(
1208 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1209 stub1: UnderscoreStatic,
1210 p2: T2,
1211 stub3: UnderscoreStatic,
1212 p4: T4
1213 ): { (p1: T1, p3: T3): T5 };
1214
1215 partial<T1, T2, T3, T4, T5>(
1216 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1217 p1: T1,
1218 stub2: UnderscoreStatic,
1219 stub3: UnderscoreStatic,
1220 p4: T4
1221 ): { (p2: T2, p3: T3): T5 };
1222
1223 partial<T1, T2, T3, T4, T5>(
1224 fn: { (p1: T1, p2: T2, p3: T3, p4: T4): T5 },
1225 stub1: UnderscoreStatic,
1226 stub2: UnderscoreStatic,
1227 stub3: UnderscoreStatic,
1228 p4: T4
1229 ): { (p1: T1, p2: T2, p3: T3): T5 };
1230
1231 partial<T1, T2, T3, T4, T5, T6>(
1232 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1233 p1: T1
1234 ): { (p2: T2, p3: T3, p4: T4, p5: T5): T6 };
1235
1236 partial<T1, T2, T3, T4, T5, T6>(
1237 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1238 p1: T1,
1239 p2: T2
1240 ): { (p3: T3, p4: T4, p5: T5): T6 };
1241
1242 partial<T1, T2, T3, T4, T5, T6>(
1243 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1244 stub1: UnderscoreStatic,
1245 p2: T2
1246 ): { (p1: T1, p3: T3, p4: T4, p5: T5): T6 };
1247
1248 partial<T1, T2, T3, T4, T5, T6>(
1249 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1250 p1: T1,
1251 p2: T2,
1252 p3: T3
1253 ): { (p4: T4, p5: T5): T6 };
1254
1255 partial<T1, T2, T3, T4, T5, T6>(
1256 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1257 stub1: UnderscoreStatic,
1258 p2: T2,
1259 p3: T3
1260 ): { (p1: T1, p4: T4, p5: T5): T6 };
1261
1262 partial<T1, T2, T3, T4, T5, T6>(
1263 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1264 p1: T1,
1265 stub2: UnderscoreStatic,
1266 p3: T3
1267 ): { (p2: T2, p4: T4, p5: T5): T6 };
1268
1269 partial<T1, T2, T3, T4, T5, T6>(
1270 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1271 stub1: UnderscoreStatic,
1272 stub2: UnderscoreStatic,
1273 p3: T3
1274 ): { (p1: T1, p2: T2, p4: T4, p5: T5): T6 };
1275
1276 partial<T1, T2, T3, T4, T5, T6>(
1277 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1278 p1: T1,
1279 p2: T2,
1280 p3: T3,
1281 p4: T4
1282 ): { (p5: T5): T6 };
1283
1284 partial<T1, T2, T3, T4, T5, T6>(
1285 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1286 stub1: UnderscoreStatic,
1287 p2: T2,
1288 p3: T3,
1289 p4: T4
1290 ): { (p1: T1, p5: T5): T6 };
1291
1292 partial<T1, T2, T3, T4, T5, T6>(
1293 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1294 p1: T1,
1295 stub2: UnderscoreStatic,
1296 p3: T3,
1297 p4: T4
1298 ): { (p2: T2, p5: T5): T6 };
1299
1300 partial<T1, T2, T3, T4, T5, T6>(
1301 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1302 stub1: UnderscoreStatic,
1303 stub2: UnderscoreStatic,
1304 p3: T3,
1305 p4: T4
1306 ): { (p1: T1, p2: T2, p5: T5): T6 };
1307
1308 partial<T1, T2, T3, T4, T5, T6>(
1309 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1310 p1: T1,
1311 p2: T2,
1312 stub3: UnderscoreStatic,
1313 p4: T4
1314 ): { (p3: T3, p5: T5): T6 };
1315
1316 partial<T1, T2, T3, T4, T5, T6>(
1317 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1318 stub1: UnderscoreStatic,
1319 p2: T2,
1320 stub3: UnderscoreStatic,
1321 p4: T4
1322 ): { (p1: T1, p3: T3, p5: T5): T6 };
1323
1324 partial<T1, T2, T3, T4, T5, T6>(
1325 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1326 p1: T1,
1327 stub2: UnderscoreStatic,
1328 stub3: UnderscoreStatic,
1329 p4: T4
1330 ): { (p2: T2, p3: T3, p5: T5): T6 };
1331
1332 partial<T1, T2, T3, T4, T5, T6>(
1333 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1334 stub1: UnderscoreStatic,
1335 stub2: UnderscoreStatic,
1336 stub3: UnderscoreStatic,
1337 p4: T4
1338 ): { (p1: T1, p2: T2, p3: T3, p5: T5): T6 };
1339
1340 partial<T1, T2, T3, T4, T5, T6>(
1341 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1342 p1: T1,
1343 p2: T2,
1344 p3: T3,
1345 p4: T4,
1346 p5: T5
1347 ): { (): T6 };
1348
1349 partial<T1, T2, T3, T4, T5, T6>(
1350 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1351 stub1: UnderscoreStatic,
1352 p2: T2,
1353 p3: T3,
1354 p4: T4,
1355 p5: T5
1356 ): { (p1: T1): T6 };
1357
1358 partial<T1, T2, T3, T4, T5, T6>(
1359 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1360 p1: T1,
1361 stub2: UnderscoreStatic,
1362 p3: T3,
1363 p4: T4,
1364 p5: T5
1365 ): { (p2: T2): T6 };
1366
1367 partial<T1, T2, T3, T4, T5, T6>(
1368 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1369 stub1: UnderscoreStatic,
1370 stub2: UnderscoreStatic,
1371 p3: T3,
1372 p4: T4,
1373 p5: T5
1374 ): { (p1: T1, p2: T2): T6 };
1375
1376 partial<T1, T2, T3, T4, T5, T6>(
1377 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1378 p1: T1,
1379 p2: T2,
1380 stub3: UnderscoreStatic,
1381 p4: T4,
1382 p5: T5
1383 ): { (p3: T3): T6 };
1384
1385 partial<T1, T2, T3, T4, T5, T6>(
1386 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1387 stub1: UnderscoreStatic,
1388 p2: T2,
1389 stub3: UnderscoreStatic,
1390 p4: T4,
1391 p5: T5
1392 ): { (p1: T1, p3: T3): T6 };
1393
1394 partial<T1, T2, T3, T4, T5, T6>(
1395 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1396 p1: T1,
1397 stub2: UnderscoreStatic,
1398 stub3: UnderscoreStatic,
1399 p4: T4,
1400 p5: T5
1401 ): { (p2: T2, p3: T3): T6 };
1402
1403 partial<T1, T2, T3, T4, T5, T6>(
1404 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1405 stub1: UnderscoreStatic,
1406 stub2: UnderscoreStatic,
1407 stub3: UnderscoreStatic,
1408 p4: T4,
1409 p5: T5
1410 ): { (p1: T1, p2: T2, p3: T3): T6 };
1411
1412 partial<T1, T2, T3, T4, T5, T6>(
1413 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1414 p1: T1,
1415 p2: T2,
1416 p3: T3,
1417 stub4: UnderscoreStatic,
1418 p5: T5
1419 ): { (p4: T4): T6 };
1420
1421 partial<T1, T2, T3, T4, T5, T6>(
1422 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1423 stub1: UnderscoreStatic,
1424 p2: T2,
1425 p3: T3,
1426 stub4: UnderscoreStatic,
1427 p5: T5
1428 ): { (p1: T1, p4: T4): T6 };
1429
1430 partial<T1, T2, T3, T4, T5, T6>(
1431 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1432 p1: T1,
1433 stub2: UnderscoreStatic,
1434 p3: T3,
1435 stub4: UnderscoreStatic,
1436 p5: T5
1437 ): { (p2: T2, p4: T4): T6 };
1438
1439 partial<T1, T2, T3, T4, T5, T6>(
1440 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1441 stub1: UnderscoreStatic,
1442 stub2: UnderscoreStatic,
1443 p3: T3,
1444 stub4: UnderscoreStatic,
1445 p5: T5
1446 ): { (p1: T1, p2: T2, p4: T4): T6 };
1447
1448 partial<T1, T2, T3, T4, T5, T6>(
1449 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1450 p1: T1,
1451 p2: T2,
1452 stub3: UnderscoreStatic,
1453 stub4: UnderscoreStatic,
1454 p5: T5
1455 ): { (p3: T3, p4: T4): T6 };
1456
1457 partial<T1, T2, T3, T4, T5, T6>(
1458 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1459 stub1: UnderscoreStatic,
1460 p2: T2,
1461 stub3: UnderscoreStatic,
1462 stub4: UnderscoreStatic,
1463 p5: T5
1464 ): { (p1: T1, p3: T3, p4: T4): T6 };
1465
1466 partial<T1, T2, T3, T4, T5, T6>(
1467 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1468 p1: T1,
1469 stub2: UnderscoreStatic,
1470 stub3: UnderscoreStatic,
1471 stub4: UnderscoreStatic,
1472 p5: T5
1473 ): { (p2: T2, p3: T3, p4: T4): T6 };
1474
1475 partial<T1, T2, T3, T4, T5, T6>(
1476 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5): T6 },
1477 stub1: UnderscoreStatic,
1478 stub2: UnderscoreStatic,
1479 stub3: UnderscoreStatic,
1480 stub4: UnderscoreStatic,
1481 p5: T5
1482 ): { (p1: T1, p2: T2, p3: T3, p4: T4): T6 };
1483
1484 partial<T1, T2, T3, T4, T5, T6, T7>(
1485 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1486 p1: T1
1487 ): { (p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 };
1488
1489 partial<T1, T2, T3, T4, T5, T6, T7>(
1490 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1491 p1: T1,
1492 p2: T2
1493 ): { (p3: T3, p4: T4, p5: T5, p6: T6): T7 };
1494
1495 partial<T1, T2, T3, T4, T5, T6, T7>(
1496 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1497 stub1: UnderscoreStatic,
1498 p2: T2
1499 ): { (p1: T1, p3: T3, p4: T4, p5: T5, p6: T6): T7 };
1500
1501 partial<T1, T2, T3, T4, T5, T6, T7>(
1502 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1503 p1: T1,
1504 p2: T2,
1505 p3: T3
1506 ): { (p4: T4, p5: T5, p6: T6): T7 };
1507
1508 partial<T1, T2, T3, T4, T5, T6, T7>(
1509 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1510 stub1: UnderscoreStatic,
1511 p2: T2,
1512 p3: T3
1513 ): { (p1: T1, p4: T4, p5: T5, p6: T6): T7 };
1514
1515 partial<T1, T2, T3, T4, T5, T6, T7>(
1516 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1517 p1: T1,
1518 stub2: UnderscoreStatic,
1519 p3: T3
1520 ): { (p2: T2, p4: T4, p5: T5, p6: T6): T7 };
1521
1522 partial<T1, T2, T3, T4, T5, T6, T7>(
1523 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1524 stub1: UnderscoreStatic,
1525 stub2: UnderscoreStatic,
1526 p3: T3
1527 ): { (p1: T1, p2: T2, p4: T4, p5: T5, p6: T6): T7 };
1528
1529 partial<T1, T2, T3, T4, T5, T6, T7>(
1530 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1531 p1: T1,
1532 p2: T2,
1533 p3: T3,
1534 p4: T4
1535 ): { (p5: T5, p6: T6): T7 };
1536
1537 partial<T1, T2, T3, T4, T5, T6, T7>(
1538 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1539 stub1: UnderscoreStatic,
1540 p2: T2,
1541 p3: T3,
1542 p4: T4
1543 ): { (p1: T1, p5: T5, p6: T6): T7 };
1544
1545 partial<T1, T2, T3, T4, T5, T6, T7>(
1546 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1547 p1: T1,
1548 stub2: UnderscoreStatic,
1549 p3: T3,
1550 p4: T4
1551 ): { (p2: T2, p5: T5, p6: T6): T7 };
1552
1553 partial<T1, T2, T3, T4, T5, T6, T7>(
1554 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1555 stub1: UnderscoreStatic,
1556 stub2: UnderscoreStatic,
1557 p3: T3,
1558 p4: T4
1559 ): { (p1: T1, p2: T2, p5: T5, p6: T6): T7 };
1560
1561 partial<T1, T2, T3, T4, T5, T6, T7>(
1562 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1563 p1: T1,
1564 p2: T2,
1565 stub3: UnderscoreStatic,
1566 p4: T4
1567 ): { (p3: T3, p5: T5, p6: T6): T7 };
1568
1569 partial<T1, T2, T3, T4, T5, T6, T7>(
1570 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1571 stub1: UnderscoreStatic,
1572 p2: T2,
1573 stub3: UnderscoreStatic,
1574 p4: T4
1575 ): { (p1: T1, p3: T3, p5: T5, p6: T6): T7 };
1576
1577 partial<T1, T2, T3, T4, T5, T6, T7>(
1578 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1579 p1: T1,
1580 stub2: UnderscoreStatic,
1581 stub3: UnderscoreStatic,
1582 p4: T4
1583 ): { (p2: T2, p3: T3, p5: T5, p6: T6): T7 };
1584
1585 partial<T1, T2, T3, T4, T5, T6, T7>(
1586 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1587 stub1: UnderscoreStatic,
1588 stub2: UnderscoreStatic,
1589 stub3: UnderscoreStatic,
1590 p4: T4
1591 ): { (p1: T1, p2: T2, p3: T3, p5: T5, p6: T6): T7 };
1592
1593 partial<T1, T2, T3, T4, T5, T6, T7>(
1594 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1595 p1: T1,
1596 p2: T2,
1597 p3: T3,
1598 p4: T4,
1599 p5: T5
1600 ): { (p6: T6): T7 };
1601
1602 partial<T1, T2, T3, T4, T5, T6, T7>(
1603 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1604 stub1: UnderscoreStatic,
1605 p2: T2,
1606 p3: T3,
1607 p4: T4,
1608 p5: T5
1609 ): { (p1: T1, p6: T6): T7 };
1610
1611 partial<T1, T2, T3, T4, T5, T6, T7>(
1612 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1613 p1: T1,
1614 stub2: UnderscoreStatic,
1615 p3: T3,
1616 p4: T4,
1617 p5: T5
1618 ): { (p2: T2, p6: T6): T7 };
1619
1620 partial<T1, T2, T3, T4, T5, T6, T7>(
1621 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1622 stub1: UnderscoreStatic,
1623 stub2: UnderscoreStatic,
1624 p3: T3,
1625 p4: T4,
1626 p5: T5
1627 ): { (p1: T1, p2: T2, p6: T6): T7 };
1628
1629 partial<T1, T2, T3, T4, T5, T6, T7>(
1630 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1631 p1: T1,
1632 p2: T2,
1633 stub3: UnderscoreStatic,
1634 p4: T4,
1635 p5: T5
1636 ): { (p3: T3, p6: T6): T7 };
1637
1638 partial<T1, T2, T3, T4, T5, T6, T7>(
1639 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1640 stub1: UnderscoreStatic,
1641 p2: T2,
1642 stub3: UnderscoreStatic,
1643 p4: T4,
1644 p5: T5
1645 ): { (p1: T1, p3: T3, p6: T6): T7 };
1646
1647 partial<T1, T2, T3, T4, T5, T6, T7>(
1648 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1649 p1: T1,
1650 stub2: UnderscoreStatic,
1651 stub3: UnderscoreStatic,
1652 p4: T4,
1653 p5: T5
1654 ): { (p2: T2, p3: T3, p6: T6): T7 };
1655
1656 partial<T1, T2, T3, T4, T5, T6, T7>(
1657 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1658 stub1: UnderscoreStatic,
1659 stub2: UnderscoreStatic,
1660 stub3: UnderscoreStatic,
1661 p4: T4,
1662 p5: T5
1663 ): { (p1: T1, p2: T2, p3: T3, p6: T6): T7 };
1664
1665 partial<T1, T2, T3, T4, T5, T6, T7>(
1666 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1667 p1: T1,
1668 p2: T2,
1669 p3: T3,
1670 stub4: UnderscoreStatic,
1671 p5: T5
1672 ): { (p4: T4, p6: T6): T7 };
1673
1674 partial<T1, T2, T3, T4, T5, T6, T7>(
1675 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1676 stub1: UnderscoreStatic,
1677 p2: T2,
1678 p3: T3,
1679 stub4: UnderscoreStatic,
1680 p5: T5
1681 ): { (p1: T1, p4: T4, p6: T6): T7 };
1682
1683 partial<T1, T2, T3, T4, T5, T6, T7>(
1684 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1685 p1: T1,
1686 stub2: UnderscoreStatic,
1687 p3: T3,
1688 stub4: UnderscoreStatic,
1689 p5: T5
1690 ): { (p2: T2, p4: T4, p6: T6): T7 };
1691
1692 partial<T1, T2, T3, T4, T5, T6, T7>(
1693 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1694 stub1: UnderscoreStatic,
1695 stub2: UnderscoreStatic,
1696 p3: T3,
1697 stub4: UnderscoreStatic,
1698 p5: T5
1699 ): { (p1: T1, p2: T2, p4: T4, p6: T6): T7 };
1700
1701 partial<T1, T2, T3, T4, T5, T6, T7>(
1702 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1703 p1: T1,
1704 p2: T2,
1705 stub3: UnderscoreStatic,
1706 stub4: UnderscoreStatic,
1707 p5: T5
1708 ): { (p3: T3, p4: T4, p6: T6): T7 };
1709
1710 partial<T1, T2, T3, T4, T5, T6, T7>(
1711 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1712 stub1: UnderscoreStatic,
1713 p2: T2,
1714 stub3: UnderscoreStatic,
1715 stub4: UnderscoreStatic,
1716 p5: T5
1717 ): { (p1: T1, p3: T3, p4: T4, p6: T6): T7 };
1718
1719 partial<T1, T2, T3, T4, T5, T6, T7>(
1720 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1721 p1: T1,
1722 stub2: UnderscoreStatic,
1723 stub3: UnderscoreStatic,
1724 stub4: UnderscoreStatic,
1725 p5: T5
1726 ): { (p2: T2, p3: T3, p4: T4, p6: T6): T7 };
1727
1728 partial<T1, T2, T3, T4, T5, T6, T7>(
1729 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1730 stub1: UnderscoreStatic,
1731 stub2: UnderscoreStatic,
1732 stub3: UnderscoreStatic,
1733 stub4: UnderscoreStatic,
1734 p5: T5
1735 ): { (p1: T1, p2: T2, p3: T3, p4: T4, p6: T6): T7 };
1736
1737 partial<T1, T2, T3, T4, T5, T6, T7>(
1738 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1739 p1: T1,
1740 p2: T2,
1741 p3: T3,
1742 p4: T4,
1743 p5: T5,
1744 p6: T6
1745 ): { (): T7 };
1746
1747 partial<T1, T2, T3, T4, T5, T6, T7>(
1748 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1749 stub1: UnderscoreStatic,
1750 p2: T2,
1751 p3: T3,
1752 p4: T4,
1753 p5: T5,
1754 p6: T6
1755 ): { (p1: T1): T7 };
1756
1757 partial<T1, T2, T3, T4, T5, T6, T7>(
1758 fn: { (p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6): T7 },
1759 p1: T1,
1760 stub2: UnderscoreStatic,
1761 p3: T3,
1762 p4: T4,
1763 p