@@ -85,8 +85,11 @@ declare module _ {
8585
8686 type EnumerableKey = string | number ;
8787
88- type CollectionKey < V > = V extends List < any > ? number
88+ type CollectionKey < V > =
89+ V extends never ? any
90+ : V extends List < any > ? number
8991 : V extends Dictionary < any > ? string
92+ : V extends undefined ? undefined
9093 : never ;
9194
9295 interface Predicate < T > {
@@ -109,9 +112,6 @@ declare module _ {
109112 null |
110113 undefined ;
111114
112- // temporary iteratee type for _Chain until _Chain return types have been fixed
113- type _ChainIteratee < V , R , T > = Iteratee < V extends Collection < T > ? V : T [ ] , R > ;
114-
115115 type IterateeResult < I , T > =
116116 I extends ( ...args : any [ ] ) => infer R ? R
117117 : I extends keyof T ? T [ I ]
@@ -914,7 +914,7 @@ declare module _ {
914914 sortedIndex < V extends List < any > > (
915915 list : V ,
916916 value : TypeOfList < V > ,
917- iteratee ?: Iteratee < V , any > ,
917+ iteratee ?: Iteratee < V | undefined , any > ,
918918 context ?: any
919919 ) : number ;
920920
@@ -3937,7 +3937,7 @@ declare module _ {
39373937 readonly VERSION : string ;
39383938 }
39393939
3940- interface Underscore < T , V = T > {
3940+ interface Underscore < T , V = T [ ] > {
39413941
39423942 /* *************
39433943 * Collections *
@@ -4536,7 +4536,7 @@ declare module _ {
45364536 * @return The index where `value` should be inserted into the wrapped
45374537 * list.
45384538 **/
4539- sortedIndex ( value : T , iteratee ?: Iteratee < V , any > , context ?: any ) : number ;
4539+ sortedIndex ( value : T , iteratee ?: Iteratee < V | undefined , any > , context ?: any ) : number ;
45404540
45414541 /**
45424542 * A function to create flexibly-numbered lists of integers, handy for
@@ -5030,7 +5030,7 @@ declare module _ {
50305030 value ( ) : V ;
50315031 }
50325032
5033- interface _Chain < T , V = T > {
5033+ interface _Chain < T , V = T [ ] > {
50345034
50355035 /* *************
50365036 * Collections *
@@ -5061,7 +5061,7 @@ declare module _ {
50615061 * @param context `this` object in `iteratee`, optional.
50625062 * @returns The mapped result in a chain wrapper.
50635063 **/
5064- map < I extends _ChainIteratee < V , any , T > > (
5064+ map < I extends Iteratee < V , any > > (
50655065 iteratee : I ,
50665066 context ?: any
50675067 ) : _Chain < IterateeResult < I , T > , IterateeResult < I , T > [ ] > ;
@@ -5138,7 +5138,7 @@ declare module _ {
51385138 * @return A chain wrapper containing the first element in the wrapped collection that passes
51395139 * the truth test or undefined if no elements pass.
51405140 **/
5141- find ( iteratee ?: _ChainIteratee < V , boolean , T > , context ?: any ) : _ChainSingle < T | undefined > ;
5141+ find ( iteratee ?: Iteratee < V , boolean > , context ?: any ) : _ChainSingle < T | undefined > ;
51425142
51435143 /**
51445144 * @see find
@@ -5152,7 +5152,7 @@ declare module _ {
51525152 * @param context `this` object in `iteratee`, optional.
51535153 * @returns The set of values that pass a truth test in a chain wrapper.
51545154 **/
5155- filter ( iteratee ?: _ChainIteratee < V , any , T > , context ?: any ) : _Chain < T , T [ ] > ;
5155+ filter ( iteratee ?: Iteratee < V , any > , context ?: any ) : _Chain < T > ;
51565156
51575157 /**
51585158 * @see filter
@@ -5165,7 +5165,7 @@ declare module _ {
51655165 * @param properties The properties to check for on the elements within the wrapped collection.
51665166 * @return The elements in the wrapped collection that match `properties` in a chain wrapper.
51675167 **/
5168- where ( properties : Partial < T > ) : _Chain < T , T [ ] > ;
5168+ where ( properties : Partial < T > ) : _Chain < T > ;
51695169
51705170 /**
51715171 * Looks through the wrapped collection and returns the first value that matches all of the key-value
@@ -5184,7 +5184,7 @@ declare module _ {
51845184 * @param context `this` object in `iteratee`, optional.
51855185 * @return The set of values that fail the truth test in a chain wrapper.
51865186 **/
5187- reject ( iteratee ?: _ChainIteratee < V , boolean , T > , context ?: any ) : _Chain < T , T [ ] > ;
5187+ reject ( iteratee ?: Iteratee < V , boolean > , context ?: any ) : _Chain < T > ;
51885188
51895189 /**
51905190 * Returns true if all of the values in the wrapped collection pass the
@@ -5195,7 +5195,7 @@ declare module _ {
51955195 * @returns A chain wrapper around true if all elements pass the truth
51965196 * test, otherwise around false.
51975197 **/
5198- every ( iterator ?: _ChainIteratee < V , boolean , T > , context ?: any ) : _ChainSingle < boolean > ;
5198+ every ( iterator ?: Iteratee < V , boolean > , context ?: any ) : _ChainSingle < boolean > ;
51995199
52005200 /**
52015201 * @see every
@@ -5211,7 +5211,7 @@ declare module _ {
52115211 * @returns A chain wrapper around true if any element passed the truth
52125212 * test, otherwise around false.
52135213 **/
5214- some ( iterator ?: _ChainIteratee < V , boolean , T > , context ?: any ) : _ChainSingle < boolean > ;
5214+ some ( iterator ?: Iteratee < V , boolean > , context ?: any ) : _ChainSingle < boolean > ;
52155215
52165216 /**
52175217 * @see some
@@ -5250,7 +5250,7 @@ declare module _ {
52505250 * @returns A chain wrapper around an array containing the result of
52515251 * the method call for each item in the wrapped collection.
52525252 **/
5253- invoke ( methodName : string , ...args : any [ ] ) : _Chain < any , any [ ] > ;
5253+ invoke ( methodName : string , ...args : any [ ] ) : _Chain < any > ;
52545254
52555255 /**
52565256 * A convenient version of what is perhaps the most common use-case for map: extracting a list of
@@ -5260,7 +5260,7 @@ declare module _ {
52605260 **/
52615261 pluck < K extends EnumerableKey > (
52625262 propertyName : K
5263- ) : _Chain < PropertyTypeOrAny < T , K > , PropertyTypeOrAny < T , K > [ ] > ;
5263+ ) : _Chain < PropertyTypeOrAny < T , K > > ;
52645264
52655265 /**
52665266 * Returns the maximum value in the wrapped collection. If an
@@ -5276,7 +5276,7 @@ declare module _ {
52765276 * wrapped collection or around -Infinity if the wrapped collection is
52775277 * empty.
52785278 **/
5279- max ( iteratee ?: _ChainIteratee < V , any , T > , context ?: any ) : _ChainSingle < T | number > ;
5279+ max ( iteratee ?: Iteratee < V , any > , context ?: any ) : _ChainSingle < T | number > ;
52805280
52815281 /**
52825282 * Returns the minimum value in the wrapped collection. If an
@@ -5292,7 +5292,7 @@ declare module _ {
52925292 * wrapped collection or around Infinity if the wrapped collection is
52935293 * empty.
52945294 **/
5295- min ( iteratee ?: _ChainIteratee < V , any , T > , context ?: any ) : _ChainSingle < T | number > ;
5295+ min ( iteratee ?: Iteratee < V , any > , context ?: any ) : _ChainSingle < T | number > ;
52965296
52975297 /**
52985298 * Returns a (stably) sorted copy of the wrapped collection, ranked in
@@ -5304,7 +5304,7 @@ declare module _ {
53045304 * @returns A chain wrapper around a sorted copy of the wrapped
53055305 * collection.
53065306 **/
5307- sortBy ( iteratee ?: _ChainIteratee < V , any , T > , context ?: any ) : _Chain < T , T [ ] > ;
5307+ sortBy ( iteratee ?: Iteratee < V , any > , context ?: any ) : _Chain < T > ;
53085308
53095309 /**
53105310 * Splits the warpped collection into sets that are grouped by the
@@ -5317,7 +5317,7 @@ declare module _ {
53175317 * provided by `iteratee` as properties where each property contains
53185318 * the grouped elements from the wrapped collection.
53195319 **/
5320- groupBy ( iteratee ?: _ChainIteratee < V , EnumerableKey , T > , context ?: any ) : _Chain < T [ ] , Dictionary < T [ ] > > ;
5320+ groupBy ( iteratee ?: Iteratee < V , EnumerableKey > , context ?: any ) : _Chain < T [ ] , Dictionary < T [ ] > > ;
53215321
53225322 /**
53235323 * Given the warpped collection and an `iteratee` function that returns
@@ -5332,7 +5332,7 @@ declare module _ {
53325332 * wrapped collection is assigned to the property designated by
53335333 * `iteratee`.
53345334 **/
5335- indexBy ( iteratee ?: _ChainIteratee < V , EnumerableKey , T > , context ?: any ) : _Chain < T , Dictionary < T > > ;
5335+ indexBy ( iteratee ?: Iteratee < V , EnumerableKey > , context ?: any ) : _Chain < T , Dictionary < T > > ;
53365336
53375337 /**
53385338 * Sorts the wrapped collection into groups and returns a count for the
@@ -5347,13 +5347,13 @@ declare module _ {
53475347 * provided by `iteratee` as properties where each property contains
53485348 * the count of the grouped elements from the wrapped collection.
53495349 **/
5350- countBy ( iterator ?: _ChainIteratee < V , EnumerableKey , T > , context ?: any ) : _Chain < number , Dictionary < number > > ;
5350+ countBy ( iterator ?: Iteratee < V , EnumerableKey > , context ?: any ) : _Chain < number , Dictionary < number > > ;
53515351
53525352 /**
53535353 * Returns a shuffled copy of the wrapped collection, using a version of the Fisher-Yates shuffle.
53545354 * @return A shuffled copy of the wrapped collection in a chain wrapper.
53555355 **/
5356- shuffle ( ) : _Chain < T , T [ ] > ;
5356+ shuffle ( ) : _Chain < T > ;
53575357
53585358 /**
53595359 * Produce a random sample from the wrapped collection. Pass a number to return `n` random elements from the
@@ -5362,7 +5362,7 @@ declare module _ {
53625362 * @return A random sample of `n` elements from the wrapped collection or a single element if `n` is not specified.
53635363 * The result will be wrapped in a chain wrapper.
53645364 **/
5365- sample ( n : number ) : _Chain < T , T [ ] > ;
5365+ sample ( n : number ) : _Chain < T > ;
53665366 sample ( ) : _ChainSingle < T | undefined > ;
53675367
53685368 /**
@@ -5371,7 +5371,7 @@ declare module _ {
53715371 * @returns A chain wrapper around an array containing the elements
53725372 * of the wrapped collection.
53735373 **/
5374- toArray ( ) : _Chain < T , T [ ] > ;
5374+ toArray ( ) : _Chain < T > ;
53755375
53765376 /**
53775377 * Determines the number of values in the wrapped collection.
@@ -5392,7 +5392,7 @@ declare module _ {
53925392 * collection that satisfied the predicate and the second element
53935393 * contains the elements that did not.
53945394 **/
5395- partition ( iteratee ?: _ChainIteratee < V , boolean , T > , context ?: any ) : _Chain < T [ ] , [ T [ ] , T [ ] ] > ;
5395+ partition ( iteratee ?: Iteratee < V , boolean > , context ?: any ) : _Chain < T [ ] , [ T [ ] , T [ ] ] > ;
53965396
53975397 /*********
53985398 * Arrays *
@@ -5406,7 +5406,7 @@ declare module _ {
54065406 * wrapped list or around the first element if `n` is omitted.
54075407 **/
54085408 first ( ) : _ChainSingle < T | undefined > ;
5409- first ( n : number ) : _Chain < T , T [ ] > ;
5409+ first ( n : number ) : _Chain < T > ;
54105410
54115411 /**
54125412 * @see first
@@ -5427,7 +5427,7 @@ declare module _ {
54275427 * @returns A chain wrapper around the elements of the wrapped list
54285428 * with the last `n` items omitted.
54295429 **/
5430- initial ( n ?: number ) : _Chain < T , T [ ] > ;
5430+ initial ( n ?: number ) : _Chain < T > ;
54315431
54325432 /**
54335433 * Returns the last element of the wrapped list. Passing `n` will
@@ -5437,7 +5437,7 @@ declare module _ {
54375437 * list or around the last element if `n` is omitted.
54385438 **/
54395439 last ( ) : _ChainSingle < T | undefined > ;
5440- last ( n : number ) : _Chain < T , T [ ] > ;
5440+ last ( n : number ) : _Chain < T > ;
54415441
54425442 /**
54435443 * Returns the rest of the elements in the wrapped list. Pass an
@@ -5447,7 +5447,7 @@ declare module _ {
54475447 * @returns A chain wrapper around the elements of the wrapped list
54485448 * from `index` to the end of the list.
54495449 **/
5450- rest ( n ?: number ) : _Chain < T , T [ ] > ;
5450+ rest ( n ?: number ) : _Chain < T > ;
54515451
54525452 /**
54535453 * @see rest
@@ -5465,7 +5465,7 @@ declare module _ {
54655465 * @returns A chain wrapper around an array containing the elements of
54665466 * the wrapped list without falsy values.
54675467 **/
5468- compact ( ) : _Chain < Truthy < T > , Truthy < T > [ ] > ;
5468+ compact ( ) : _Chain < Truthy < T > > ;
54695469
54705470 /**
54715471 * Flattens the wrapped nested list (the nesting can be to any depth). If you pass shallow, the list will
@@ -5483,7 +5483,7 @@ declare module _ {
54835483 * @return A chain wrapper around an array that contains all elements
54845484 * of the wrapped list except for `values`.
54855485 **/
5486- without ( ...values : T [ ] ) : _Chain < T , T [ ] > ;
5486+ without ( ...values : T [ ] ) : _Chain < T > ;
54875487
54885488 /**
54895489 * Computes the union of the wrapped list and the passed-in `lists`:
@@ -5494,7 +5494,7 @@ declare module _ {
54945494 * @returns A chain wrapper around the union of elements within the
54955495 * wrapped list and `lists`.
54965496 **/
5497- union ( ...lists : List < T > [ ] ) : _Chain < T , T [ ] > ;
5497+ union ( ...lists : List < T > [ ] ) : _Chain < T > ;
54985498
54995499 /**
55005500 * Computes the list of values that are the intersection of the wrapped
@@ -5505,7 +5505,7 @@ declare module _ {
55055505 * @returns A chain wrapper around the intersection of elements within
55065506 * the the wrapped list and `lists`.
55075507 **/
5508- intersection ( ...lists : List < T > [ ] ) : _Chain < T , T [ ] > ;
5508+ intersection ( ...lists : List < T > [ ] ) : _Chain < T > ;
55095509
55105510 /**
55115511 * Similar to without, but returns the values from the wrapped list
@@ -5515,7 +5515,7 @@ declare module _ {
55155515 * @returns A chain wrapper around the contents of the wrapped list
55165516 * without the values in `others`.
55175517 **/
5518- difference ( ...others : List < T > [ ] ) : _Chain < T , T [ ] > ;
5518+ difference ( ...others : List < T > [ ] ) : _Chain < T > ;
55195519
55205520 /**
55215521 * Produces a duplicate-free version of the wrapped list, using === to
@@ -5531,8 +5531,8 @@ declare module _ {
55315531 * @return A chain wrapper around an array containing only the unique
55325532 * elements in the wrapped list.
55335533 **/
5534- uniq ( isSorted ?: boolean , iteratee ?: _ChainIteratee < V , any , T > , context ?: any ) : _Chain < T , T [ ] > ;
5535- uniq ( iteratee ?: _ChainIteratee < V , any , T > , context ?: any ) : _Chain < T , T [ ] > ;
5534+ uniq ( isSorted ?: boolean , iteratee ?: Iteratee < V , any > , context ?: any ) : _Chain < T > ;
5535+ uniq ( iteratee ?: Iteratee < V , any > , context ?: any ) : _Chain < T > ;
55365536
55375537 /**
55385538 * Wrapped type List<T>.
@@ -5548,7 +5548,7 @@ declare module _ {
55485548 * @returns A chain wrapper around the zipped version of the wrapped
55495549 * list and `lists`.
55505550 **/
5551- zip ( ...arrays : List < any > [ ] ) : _Chain < any [ ] , any [ ] [ ] > ;
5551+ zip ( ...arrays : List < any > [ ] ) : _Chain < any [ ] > ;
55525552
55535553 /**
55545554 * The opposite of zip. Given the wrapped list of lists, returns a
@@ -5558,7 +5558,7 @@ declare module _ {
55585558 * @returns A chain wrapper aoround the unzipped version of the wrapped
55595559 * lists.
55605560 **/
5561- unzip ( ) : _Chain < any [ ] , any [ ] [ ] > ;
5561+ unzip ( ) : _Chain < any [ ] > ;
55625562
55635563 /**
55645564 * Converts lists into objects. Call on either a wrapped list of
@@ -5646,7 +5646,7 @@ declare module _ {
56465646 * @return A chain wrapper around the index where `value` should be
56475647 * inserted into the wrapped list.
56485648 **/
5649- sortedIndex ( value : T , iteratee ?: _ChainIteratee < V , any , T > , context ?: any ) : _ChainSingle < number > ;
5649+ sortedIndex ( value : T , iteratee ?: Iteratee < V | undefined , any > , context ?: any ) : _ChainSingle < number > ;
56505650
56515651 /**
56525652 * A function to create flexibly-numbered lists of integers, handy for
@@ -5664,14 +5664,14 @@ declare module _ {
56645664 * @returns A chain wrapper around an array of numbers from start to
56655665 * `stop` with increments of `step`.
56665666 **/
5667- range ( stop ?: number , step ?: number ) : _Chain < number , number [ ] > ;
5667+ range ( stop ?: number , step ?: number ) : _Chain < number > ;
56685668
56695669 /**
56705670 * Chunks a wrapped list into multiple arrays, each containing length or fewer items.
56715671 * @param length The maximum size of the inner arrays.
56725672 * @returns The wrapped chunked list.
56735673 **/
5674- chunk ( length : number ) : _Chain < T [ ] , T [ ] [ ] > ;
5674+ chunk ( length : number ) : _Chain < T [ ] > ;
56755675
56765676 /* ***********
56775677 * Functions *
0 commit comments