Lodash: Improve support for NumericDictionary collections (#24052)

* Change NumericDictionaryIterator's "key" to type "string"

* Finish updating unit tests

* Improve support of NumericDictionary.
* Update signature overloads of many methods.
* Improve many unit tests.

* Fix some mapValues overloads

* Revert changes to V3 files

* Improve _.omit to fully support Dictionary and NumericDictionary

* Remove unused DictionaryIterator typedefs

* Improve signatures of mapValues and add tons of unit tests

* Remove _.sample overloads that did not potentially  return undefined.

* Simplify definition of "AnyKindOfDictionary"

* Fix one of the _.mapValues overloads

* Delete unnecessary/incorrect comments

* Improve _.forEach unit tests

* Clean up unit tests for mapValues

* Clean up unit tests for _.map

* Add more NumericDictionary test coverage

* Fix _.map to accept a PropertyPath param instead of just a string.

* Re-add DictionaryIterator and NumericDictionaryIterator definitions
for backward compatibility.

* Revert change to support PropertyPath in _.map

* Comment out parts of _.forEach tests that fail in TS 2.4

* Fix _.unionBy tests for TS 2.3

* Comment out _.mapKeys tests that break in TS 2.4

* Comment out parts of _.forEach tests that fail in TS 2.4 (again)

* Fix _.xor test that was broken in TS 2.3

* Comment out parts of _.map tests that fail in TS 2.4

* Remove invalid tests for _.some

* Remove "object" type from definition of ObjectIterateeCustom

* Comment out _.pick tests broken in TS 2.4
This commit is contained in:
Jeff Lau
2018-03-15 09:36:44 -07:00
committed by Andy
parent 52bde4982f
commit 9fb4bc7089
4 changed files with 1616 additions and 1620 deletions
+58 -426
View File
@@ -36,14 +36,6 @@ declare module "../index" {
iteratee?: ListIteratee<T>
): Dictionary<number>;
/**
* @see _.countBy
*/
countBy<T>(
collection: NumericDictionary<T> | null | undefined,
iteratee?: NumericDictionaryIteratee<T>
): Dictionary<number>;
/**
* @see _.countBy
*/
@@ -77,14 +69,6 @@ declare module "../index" {
this: LoDashImplicitWrapper<T | null | undefined>,
iteratee?: ObjectIteratee<T>
): LoDashImplicitWrapper<Dictionary<number>>;
/**
* @see _.countBy
*/
countBy<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee?: NumericDictionaryIteratee<T>
): LoDashImplicitWrapper<Dictionary<number>>;
}
interface LoDashExplicitWrapper<TValue> {
@@ -111,14 +95,6 @@ declare module "../index" {
this: LoDashExplicitWrapper<T | null | undefined>,
iteratee?: ObjectIteratee<T>
): LoDashExplicitWrapper<Dictionary<number>>;
/**
* @see _.countBy
*/
countBy<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee?: NumericDictionaryIteratee<T>
): LoDashExplicitWrapper<Dictionary<number>>;
}
// each
@@ -217,14 +193,6 @@ declare module "../index" {
predicate?: ListIterateeCustom<T, boolean>
): boolean;
/**
* @see _.every
*/
every<T>(
collection: NumericDictionary<T> | null | undefined,
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): boolean;
/**
* @see _.every
*/
@@ -250,14 +218,6 @@ declare module "../index" {
this: LoDashImplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeCustom<T, boolean>
): boolean;
/**
* @see _.every
*/
every<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): boolean;
}
interface LoDashExplicitWrapper<TValue> {
@@ -276,14 +236,6 @@ declare module "../index" {
this: LoDashExplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeCustom<T, boolean>
): LoDashExplicitWrapper<boolean>;
/**
* @see _.every
*/
every<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): LoDashExplicitWrapper<boolean>;
}
// filter
@@ -712,14 +664,6 @@ declare module "../index" {
iteratee: ListIterator<T, Many<TResult>>
): TResult[];
/**
* @see _.flatMap
*/
flatMap<T, TResult>(
collection: NumericDictionary<T> | null | undefined,
iteratee: NumericDictionaryIterator<T, Many<TResult>>
): TResult[];
/**
* @see _.flatMap
*/
@@ -772,14 +716,6 @@ declare module "../index" {
iteratee: ObjectIterator<T, Many<TResult>>
): LoDashImplicitWrapper<TResult[]>;
/**
* @see _.flatMap
*/
flatMap<T, TResult>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee: NumericDictionaryIterator<T, Many<TResult>>
): LoDashImplicitWrapper<TResult[]>;
/**
* @see _.flatMap
*/
@@ -814,14 +750,6 @@ declare module "../index" {
iteratee: ListIterator<T, Many<TResult>>
): LoDashExplicitWrapper<TResult[]>;
/**
* @see _.flatMap
*/
flatMap<T, TResult>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee: NumericDictionaryIterator<T, Many<TResult>>
): LoDashExplicitWrapper<TResult[]>;
/**
* @see _.flatMap
*/
@@ -878,14 +806,6 @@ declare module "../index" {
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>
): TResult[];
/**
* @see _.flatMapDeep
*/
flatMapDeep<T, TResult>(
collection: NumericDictionary<T> | null | undefined,
iteratee: NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>
): TResult[];
/**
* @see _.flatMapDeep
*/
@@ -927,14 +847,6 @@ declare module "../index" {
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>
): LoDashImplicitWrapper<TResult[]>;
/**
* @see _.flatMapDeep
*/
flatMapDeep<T, TResult>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee: NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>
): LoDashImplicitWrapper<TResult[]>;
/**
* @see _.flatMapDeep
*/
@@ -976,14 +888,6 @@ declare module "../index" {
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>
): LoDashExplicitWrapper<TResult[]>;
/**
* @see _.flatMapDeep
*/
flatMapDeep<T, TResult>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee: NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>
): LoDashExplicitWrapper<TResult[]>;
/**
* @see _.flatMapDeep
*/
@@ -1044,15 +948,6 @@ declare module "../index" {
depth?: number
): TResult[];
/**
* @see _.flatMapDepth
*/
flatMapDepth<T, TResult>(
collection: NumericDictionary<T> | null | undefined,
iteratee: NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>,
depth?: number
): TResult[];
/**
* @see _.flatMapDepth
*/
@@ -1098,15 +993,6 @@ declare module "../index" {
depth?: number
): LoDashImplicitWrapper<TResult[]>;
/**
* @see _.flatMapDepth
*/
flatMapDepth<T, TResult>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee: NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>,
depth?: number
): LoDashImplicitWrapper<TResult[]>;
/**
* @see _.flatMapDepth
*/
@@ -1152,15 +1038,6 @@ declare module "../index" {
depth?: number
): LoDashExplicitWrapper<TResult[]>;
/**
* @see _.flatMapDepth
*/
flatMapDepth<T, TResult>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee: NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>,
depth?: number
): LoDashExplicitWrapper<TResult[]>;
/**
* @see _.flatMapDepth
*/
@@ -1446,14 +1323,6 @@ declare module "../index" {
iteratee?: ListIteratee<T>
): Dictionary<T[]>;
/**
* @see _.groupBy
*/
groupBy<T>(
collection: NumericDictionary<T> | null | undefined,
iteratee?: NumericDictionaryIteratee<T>
): Dictionary<T[]>;
/**
* @see _.groupBy
*/
@@ -1487,14 +1356,6 @@ declare module "../index" {
this: LoDashImplicitWrapper<T | null | undefined>,
iteratee?: ObjectIteratee<T>
): LoDashImplicitWrapper<Dictionary<Array<T[keyof T]>>>;
/**
* @see _.groupBy
*/
groupBy<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee?: NumericDictionaryIteratee<T>
): LoDashImplicitWrapper<Dictionary<T[]>>;
}
interface LoDashExplicitWrapper<TValue> {
@@ -1514,14 +1375,6 @@ declare module "../index" {
iteratee?: ListIteratee<T>
): LoDashExplicitWrapper<Dictionary<T[]>>;
/**
* @see _.groupBy
*/
groupBy<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee?: NumericDictionaryIteratee<T>
): LoDashExplicitWrapper<Dictionary<T[]>>;
/**
* @see _.groupBy
*/
@@ -1544,7 +1397,7 @@ declare module "../index" {
* @return True if the target element is found, else false.
*/
includes<T>(
collection: List<T>|Dictionary<T> | null | undefined,
collection: List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined,
target: T,
fromIndex?: number
): boolean;
@@ -1555,7 +1408,7 @@ declare module "../index" {
* @see _.includes
*/
includes<T>(
this: LoDashImplicitWrapper<List<T> | Dictionary<T> | null | undefined>,
this: LoDashImplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>,
target: T,
fromIndex?: number
): boolean;
@@ -1566,7 +1419,7 @@ declare module "../index" {
* @see _.includes
*/
includes<T>(
this: LoDashExplicitWrapper<List<T> | Dictionary<T> | null | undefined>,
this: LoDashExplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>,
target: T,
fromIndex?: number
): LoDashExplicitWrapper<boolean>;
@@ -1673,14 +1526,6 @@ declare module "../index" {
collection: T | null | undefined,
iteratee?: ObjectIterateeCustom<T, PropertyName>
): Dictionary<T[keyof T]>;
/**
* @see _.keyBy
*/
keyBy<T>(
collection: NumericDictionary<T> | null | undefined,
iteratee?: NumericDictionaryIterateeCustom<T, PropertyName>
): Dictionary<T>;
}
interface LoDashImplicitWrapper<TValue> {
@@ -1707,14 +1552,6 @@ declare module "../index" {
this: LoDashImplicitWrapper<T | null | undefined>,
iteratee?: ObjectIterateeCustom<T, PropertyName>
): LoDashImplicitWrapper<Dictionary<T[keyof T]>>;
/**
* @see _.keyBy
*/
keyBy<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee?: NumericDictionaryIterateeCustom<T, PropertyName>
): LoDashImplicitWrapper<Dictionary<T>>;
}
interface LoDashExplicitWrapper<TValue> {
@@ -1741,14 +1578,6 @@ declare module "../index" {
this: LoDashExplicitWrapper<T | null | undefined>,
iteratee?: ObjectIterateeCustom<T, PropertyName>
): LoDashExplicitWrapper<Dictionary<T[keyof T]>>;
/**
* @see _.keyBy
*/
keyBy<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee?: NumericDictionaryIterateeCustom<T, PropertyName>
): LoDashExplicitWrapper<Dictionary<T>>;
}
// map
@@ -1780,6 +1609,14 @@ declare module "../index" {
* @param thisArg The this binding of iteratee.
* @return Returns the new mapped array.
*/
map<T, TResult>(
collection: T[] | null | undefined,
iteratee: ArrayIterator<T, TResult>
): TResult[];
/**
* @see _.map
*/
map<T, TResult>(
collection: List<T> | null | undefined,
iteratee: ListIterator<T, TResult>
@@ -1788,46 +1625,48 @@ declare module "../index" {
/**
* @see _.map
*/
map<T>(collection: List<T> | Dictionary<T> | null | undefined): T[];
map<T>(collection: List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined): T[];
/**
* @see _.map
*/
map<T, TResult>(
collection: Dictionary<T> | null | undefined,
iteratee: DictionaryIterator<T, TResult>
map<T extends object, TResult>(
collection: T | null | undefined,
iteratee: ObjectIterator<T, TResult>
): TResult[];
/** @see _.map */
map<T, K extends keyof T>(
collection: List<T> | Dictionary<T> | null | undefined,
collection: List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined,
iteratee: K
): Array<T[K]>;
/** @see _.map */
map<T, TResult>(
collection: NumericDictionary<T> | null | undefined,
iteratee?: NumericDictionaryIterator<T, TResult>
): TResult[];
/**
* @see _.map
*/
map<T, TResult>(
collection: List<T>|Dictionary<T>|NumericDictionary<T> | null | undefined,
iteratee?: string
): TResult[];
/**
* @see _.map
*/
map<T>(
collection: List<T>|Dictionary<T>|NumericDictionary<T> | null | undefined,
collection: List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined,
iteratee?: string
): any[];
/**
* @see _.map
*/
map<T>(
collection: List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined,
iteratee?: object
): boolean[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.map
*/
map<T, TResult>(
this: LoDashImplicitWrapper<T[] | null | undefined>,
iteratee: ArrayIterator<T, TResult>
): LoDashImplicitWrapper<TResult[]>;
/**
* @see _.map
*/
@@ -1839,35 +1678,29 @@ declare module "../index" {
/**
* @see _.map
*/
map<T>(this: LoDashImplicitWrapper<List<T> | Dictionary<T> | null | undefined>): LoDashImplicitWrapper<T[]>;
map<T>(this: LoDashImplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>): LoDashImplicitWrapper<T[]>;
/**
* @see _.map
*/
map<T, TResult>(
this: LoDashImplicitWrapper<Dictionary<T> | null | undefined>,
iteratee: DictionaryIterator<T, TResult>
map<T extends object, TResult>(
this: LoDashImplicitWrapper<T | null | undefined>,
iteratee: ObjectIterator<T, TResult>
): LoDashImplicitWrapper<TResult[]>;
/** @see _.map */
map<T, K extends keyof T>(
this: LoDashImplicitWrapper<List<T> | Dictionary<T> | null | undefined>,
this: LoDashImplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>,
iteratee: K
): LoDashImplicitWrapper<Array<T[K]>>;
/** @see _.map */
map<T, TResult>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee?: NumericDictionaryIterator<T, TResult>
): LoDashImplicitWrapper<TResult[]>;
/**
* @see _.map
*/
map<T, TResult>(
map<T>(
this: LoDashImplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>,
iteratee?: string
): LoDashImplicitWrapper<TResult[]>;
): LoDashImplicitWrapper<any[]>;
/**
* @see _.map
@@ -1879,6 +1712,14 @@ declare module "../index" {
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.map
*/
map<T, TResult>(
this: LoDashExplicitWrapper<T[] | null | undefined>,
iteratee: ArrayIterator<T, TResult>
): LoDashExplicitWrapper<TResult[]>;
/**
* @see _.map
*/
@@ -1890,37 +1731,29 @@ declare module "../index" {
/**
* @see _.map
*/
map<T>(this: LoDashExplicitWrapper<List<T> | Dictionary<T> | null | undefined>): LoDashExplicitWrapper<T[]>;
map<T>(this: LoDashExplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>): LoDashExplicitWrapper<T[]>;
/**
* @see _.map
*/
map<T, TResult>(
this: LoDashExplicitWrapper<Dictionary<T> | null | undefined>,
iteratee: DictionaryIterator<T, TResult>
map<T extends object, TResult>(
this: LoDashExplicitWrapper<T | null | undefined>,
iteratee: ObjectIterator<T, TResult>
): LoDashExplicitWrapper<TResult[]>;
/** @see _.map */
map<T, K extends keyof T>(
this: LoDashExplicitWrapper<List<T> | Dictionary<T> | null | undefined>,
this: LoDashExplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>,
iteratee: K
): LoDashExplicitWrapper<Array<T[K]>>;
/**
* @see _.map
*/
map<T, TResult>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee?: NumericDictionaryIterator<T, TResult>
): LoDashExplicitWrapper<TResult[]>;
/**
* @see _.map
*/
map<T, TResult>(
map<T>(
this: LoDashExplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>,
iteratee?: string
): LoDashExplicitWrapper<TResult[]>;
): LoDashExplicitWrapper<any[]>;
/**
* @see _.map
@@ -1991,24 +1824,6 @@ declare module "../index" {
iteratees?: Many<ObjectIteratee<T>>,
orders?: Many<boolean|string>
): Array<T[keyof T]>;
/**
* @see _.orderBy
*/
orderBy<T>(
collection: NumericDictionary<T> | null | undefined,
iteratees?: Many<NumericDictionaryIterator<T, NotVoid>>,
orders?: Many<boolean|string>
): T[];
/**
* @see _.orderBy
*/
orderBy<T>(
collection: NumericDictionary<T> | null | undefined,
iteratees?: Many<NumericDictionaryIteratee<T>>,
orders?: Many<boolean|string>
): T[];
}
interface LoDashImplicitWrapper<TValue> {
@@ -2047,24 +1862,6 @@ declare module "../index" {
iteratees?: Many<ObjectIteratee<T>>,
orders?: Many<boolean|string>
): LoDashImplicitWrapper<Array<T[keyof T]>>;
/**
* @see _.orderBy
*/
orderBy<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratees?: Many<NumericDictionaryIterator<T, NotVoid>>,
orders?: Many<boolean|string>
): LoDashImplicitWrapper<T[]>;
/**
* @see _.orderBy
*/
orderBy<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratees?: Many<NumericDictionaryIteratee<T>>,
orders?: Many<boolean|string>
): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
@@ -2103,24 +1900,6 @@ declare module "../index" {
iteratees?: Many<ObjectIteratee<T>>,
orders?: Many<boolean|string>
): LoDashExplicitWrapper<Array<T[keyof T]>>;
/**
* @see _.orderBy
*/
orderBy<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratees?: Many<NumericDictionaryIterator<T, NotVoid>>,
orders?: Many<boolean|string>
): LoDashExplicitWrapper<T[]>;
/**
* @see _.orderBy
*/
orderBy<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratees?: Many<NumericDictionaryIteratee<T>>,
orders?: Many<boolean|string>
): LoDashExplicitWrapper<T[]>;
}
// partition
@@ -2233,15 +2012,6 @@ declare module "../index" {
accumulator: TResult
): TResult;
/**
* @see _.reduce
**/
reduce<T, TResult>(
collection: NumericDictionary<T> | null | undefined,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>,
accumulator: TResult
): TResult;
/**
* @see _.reduce
**/
@@ -2265,14 +2035,6 @@ declare module "../index" {
collection: T | null | undefined,
callback: MemoObjectIterator<T[keyof T], TResult, T>
): TResult | undefined;
/**
* @see _.reduce
**/
reduce<T, TResult>(
collection: NumericDictionary<T> | null | undefined,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>
): TResult | undefined;
}
interface LoDashImplicitWrapper<TValue> {
@@ -2303,15 +2065,6 @@ declare module "../index" {
accumulator: TResult
): TResult;
/**
* @see _.reduce
**/
reduce<T, TResult>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>,
accumulator: TResult
): TResult;
/**
* @see _.reduce
**/
@@ -2335,14 +2088,6 @@ declare module "../index" {
this: LoDashImplicitWrapper<T | null | undefined>,
callback: MemoObjectIterator<T[keyof T], TResult, T>
): TResult | undefined;
/**
* @see _.reduce
**/
reduce<T, TResult>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>
): TResult | undefined;
}
interface LoDashExplicitWrapper<TValue> {
@@ -2373,15 +2118,6 @@ declare module "../index" {
accumulator: TResult
): LoDashExplicitWrapper<TResult>;
/**
* @see _.reduce
**/
reduce<T, TResult>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>,
accumulator: TResult
): LoDashExplicitWrapper<TResult>;
/**
* @see _.reduce
**/
@@ -2405,14 +2141,6 @@ declare module "../index" {
this: LoDashExplicitWrapper<T | null | undefined>,
callback: MemoObjectIterator<T[keyof T], TResult, T>
): LoDashExplicitWrapper<TResult | undefined>;
/**
* @see _.reduce
**/
reduce<T, TResult>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>
): LoDashExplicitWrapper<TResult | undefined>;
}
// reduceRight
@@ -2450,15 +2178,6 @@ declare module "../index" {
accumulator: TResult
): TResult;
/**
* @see _.reduceRight
**/
reduceRight<T, TResult>(
collection: NumericDictionary<T> | null | undefined,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>,
accumulator: TResult
): TResult;
/**
* @see _.reduceRight
**/
@@ -2482,14 +2201,6 @@ declare module "../index" {
collection: T | null | undefined,
callback: MemoObjectIterator<T[keyof T], TResult, T>
): TResult | undefined;
/**
* @see _.reduceRight
**/
reduceRight<T, TResult>(
collection: NumericDictionary<T> | null | undefined,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>
): TResult | undefined;
}
interface LoDashImplicitWrapper<TValue> {
@@ -2520,15 +2231,6 @@ declare module "../index" {
accumulator: TResult
): TResult;
/**
* @see _.reduceRight
**/
reduceRight<T, TResult>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>,
accumulator: TResult
): TResult;
/**
* @see _.reduceRight
**/
@@ -2552,14 +2254,6 @@ declare module "../index" {
this: LoDashImplicitWrapper<T | null | undefined>,
callback: MemoObjectIterator<T[keyof T], TResult, T>
): TResult | undefined;
/**
* @see _.reduceRight
**/
reduceRight<T, TResult>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>
): TResult | undefined;
}
interface LoDashExplicitWrapper<TValue> {
@@ -2590,15 +2284,6 @@ declare module "../index" {
accumulator: TResult
): LoDashExplicitWrapper<TResult>;
/**
* @see _.reduceRight
**/
reduceRight<T, TResult>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>,
accumulator: TResult
): LoDashExplicitWrapper<TResult>;
/**
* @see _.reduceRight
**/
@@ -2622,14 +2307,6 @@ declare module "../index" {
this: LoDashExplicitWrapper<T | null | undefined>,
callback: MemoObjectIterator<T[keyof T], TResult, T>
): LoDashExplicitWrapper<TResult | undefined>;
/**
* @see _.reduceRight
**/
reduceRight<T, TResult>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
callback: MemoListIterator<T, TResult, NumericDictionary<T>>
): LoDashExplicitWrapper<TResult | undefined>;
}
// reject
@@ -2731,13 +2408,6 @@ declare module "../index" {
collection: List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined
): T | undefined;
/**
* @see _.sample
*/
sample<T extends object>(
collection: T
): T[keyof T];
/**
* @see _.sample
*/
@@ -2754,13 +2424,6 @@ declare module "../index" {
this: LoDashImplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>
): T | undefined;
/**
* @see _.sample
*/
sample<T extends object>(
this: LoDashImplicitWrapper<T>,
): T[keyof T];
/**
* @see _.sample
*/
@@ -2777,13 +2440,6 @@ declare module "../index" {
this: LoDashExplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>
): LoDashExplicitWrapper<T | undefined>;
/**
* @see _.sample
*/
sample<T extends object>(
this: LoDashExplicitWrapper<T>,
): LoDashExplicitWrapper<T[keyof T]>;
/**
* @see _.sample
*/
@@ -2803,7 +2459,7 @@ declare module "../index" {
* @return Returns the random elements.
*/
sampleSize<T>(
collection: List<T>|Dictionary<T>|NumericDictionary<T> | null | undefined,
collection: List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined,
n?: number
): T[];
@@ -2821,7 +2477,7 @@ declare module "../index" {
* @see _.sampleSize
*/
sampleSize<T>(
this: LoDashImplicitWrapper<List<T>|Dictionary<T>|NumericDictionary<T> | null | undefined>,
this: LoDashImplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>,
n?: number
): LoDashImplicitWrapper<T[]>;
@@ -2839,7 +2495,7 @@ declare module "../index" {
* @see _.sampleSize
*/
sampleSize<T>(
this: LoDashExplicitWrapper<List<T>|Dictionary<T>|NumericDictionary<T> | null | undefined>,
this: LoDashExplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>,
n?: number
): LoDashExplicitWrapper<T[]>;
@@ -2943,14 +2599,6 @@ declare module "../index" {
collection: T | null | undefined,
predicate?: ObjectIterateeCustom<T, boolean>
): boolean;
/**
* @see _.some
*/
some<T>(
collection: NumericDictionary<T> | null | undefined,
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): boolean;
}
interface LoDashImplicitWrapper<TValue> {
@@ -2969,14 +2617,6 @@ declare module "../index" {
this: LoDashImplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeCustom<T, boolean>
): boolean;
/**
* @see _.some
*/
some<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): boolean;
}
interface LoDashExplicitWrapper<TValue> {
@@ -2995,14 +2635,6 @@ declare module "../index" {
this: LoDashExplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeCustom<T, boolean>
): LoDashExplicitWrapper<boolean>;
/**
* @see _.some
*/
some<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): LoDashExplicitWrapper<boolean>;
}
// sortBy
+14 -9
View File
@@ -188,17 +188,9 @@ declare module "../index" {
// 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<TObject, TResult> = (value: TObject[keyof TObject], key: string, collection: TObject) => TResult;
type ObjectIteratee<TObject> = ObjectIterator<TObject, NotVoid> | string | [string, any] | PartialDeep<TObject[keyof TObject]>;
type ObjectIterateeCustom<TObject, TResult> = ObjectIterator<TObject, TResult> | string | object | [string, any] | PartialDeep<TObject[keyof TObject]>;
type ObjectIterateeCustom<TObject, TResult> = ObjectIterator<TObject, TResult> | string | [string, any] | PartialDeep<TObject[keyof TObject]>;
type ObjectIteratorTypeGuard<TObject, S extends TObject[keyof TObject]> = (value: TObject[keyof TObject], key: string, collection: TObject) => value is S;
type DictionaryIterator<T, TResult> = ObjectIterator<Dictionary<T>, TResult>;
type DictionaryIteratee<T> = ObjectIteratee<Dictionary<T>>;
type DictionaryIteratorTypeGuard<T, S extends T> = ObjectIteratorTypeGuard<Dictionary<T>, S>;
type NumericDictionaryIterator<T, TResult> = (value: T, key: number, collection: NumericDictionary<T>) => TResult;
type NumericDictionaryIteratee<T> = NumericDictionaryIterator<T, NotVoid> | string | [string, any] | PartialDeep<T>;
type NumericDictionaryIterateeCustom<T, TResult> = NumericDictionaryIterator<T, TResult> | string | [string, any] | PartialDeep<T>;
type StringIterator<TResult> = (char: string, index: number, string: string) => TResult;
type MemoVoidIterator<T, TResult> = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => void;
@@ -230,6 +222,11 @@ declare module "../index" {
[index: number]: T;
}
// Crazy typedef needed get _.omit to work properly with Dictionary and NumericDictionary
type AnyKindOfDictionary =
| Dictionary<{} | null | undefined>
| NumericDictionary<{} | null | undefined>;
interface Cancelable {
cancel(): void;
flush(): void;
@@ -252,4 +249,12 @@ declare module "../index" {
type LoDashExplicitNillableObjectWrapper<T> = LoDashExplicitWrapper<T | null | undefined>;
type LoDashExplicitNumberArrayWrapper = LoDashExplicitWrapper<number[]>;
type LoDashExplicitStringWrapper = LoDashExplicitWrapper<string>;
type DictionaryIterator<T, TResult> = ObjectIterator<Dictionary<T>, TResult>;
type DictionaryIteratee<T> = ObjectIteratee<Dictionary<T>>;
type DictionaryIteratorTypeGuard<T, S extends T> = ObjectIteratorTypeGuard<Dictionary<T>, S>;
// NOTE: keys of objects at run time are always strings, even when a NumericDictionary is being iterated.
type NumericDictionaryIterator<T, TResult> = (value: T, key: string, collection: NumericDictionary<T>) => TResult;
type NumericDictionaryIteratee<T> = NumericDictionaryIterator<T, NotVoid> | string | [string, any] | PartialDeep<T>;
type NumericDictionaryIterateeCustom<T, TResult> = NumericDictionaryIterator<T, TResult> | string | [string, any] | PartialDeep<T>;
}
+166 -97
View File
@@ -718,7 +718,7 @@ declare module "../index" {
* @return Returns the new array of picked elements.
*/
at<T>(
object: List<T> | Dictionary<T> | null | undefined,
object: List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined,
...props: PropertyPath[]
): T[];
@@ -736,7 +736,7 @@ declare module "../index" {
* @see _.at
*/
at<T>(
this: LoDashImplicitWrapper<List<T> | Dictionary<T> | null | undefined>,
this: LoDashImplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>,
...props: PropertyPath[]
): LoDashImplicitWrapper<T[]>;
@@ -754,7 +754,7 @@ declare module "../index" {
* @see _.at
*/
at<T>(
this: LoDashExplicitWrapper<List<T> | Dictionary<T> | null | undefined>,
this: LoDashExplicitWrapper<List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined>,
...props: PropertyPath[]
): LoDashExplicitWrapper<T[]>;
@@ -987,7 +987,7 @@ declare module "../index" {
/**
* @see _.toPairs
*/
entries<T>(object?: Dictionary<T>): Array<[string, T]>;
entries<T>(object?: Dictionary<T> | NumericDictionary<T>): Array<[string, T]>;
/**
* @see _.toPairs
@@ -999,7 +999,7 @@ declare module "../index" {
/**
* @see _.toPairs
*/
entries<T>(this: LoDashImplicitWrapper<Dictionary<T>>): LoDashImplicitWrapper<Array<[string, T]>>;
entries<T>(this: LoDashImplicitWrapper<Dictionary<T> | NumericDictionary<T>>): LoDashImplicitWrapper<Array<[string, T]>>;
/**
* @see _.toPairs
@@ -1011,7 +1011,7 @@ declare module "../index" {
/**
* @see _.toPairs
*/
entries<T>(this: LoDashExplicitWrapper<Dictionary<T>>): LoDashExplicitWrapper<Array<[string, T]>>;
entries<T>(this: LoDashExplicitWrapper<Dictionary<T> | NumericDictionary<T>>): LoDashExplicitWrapper<Array<[string, T]>>;
/**
* @see _.toPairs
@@ -1025,7 +1025,7 @@ declare module "../index" {
/**
* @see _.entriesIn
*/
entriesIn<T>(object?: Dictionary<T>): Array<[string, T]>;
entriesIn<T>(object?: Dictionary<T> | NumericDictionary<T>): Array<[string, T]>;
/**
* @see _.entriesIn
@@ -1037,7 +1037,7 @@ declare module "../index" {
/**
* @see _.entriesIn
*/
entriesIn<T>(this: LoDashImplicitWrapper<Dictionary<T>>): LoDashImplicitWrapper<Array<[string, T]>>;
entriesIn<T>(this: LoDashImplicitWrapper<Dictionary<T> | NumericDictionary<T>>): LoDashImplicitWrapper<Array<[string, T]>>;
/**
* @see _.entriesIn
@@ -1049,7 +1049,7 @@ declare module "../index" {
/**
* @see _.entriesIn
*/
entriesIn<T>(this: LoDashExplicitWrapper<Dictionary<T>>): LoDashExplicitWrapper<Array<[string, T]>>;
entriesIn<T>(this: LoDashExplicitWrapper<Dictionary<T> | NumericDictionary<T>>): LoDashExplicitWrapper<Array<[string, T]>>;
/**
* @see _.entriesIn
@@ -2210,18 +2210,10 @@ declare module "../index" {
/**
* @see _.mapKeys
*/
mapKeys<T>(
object: Dictionary<T> | null | undefined,
iteratee?: DictionaryIteratee<T>
): Dictionary<T>;
/**
* @see _.mapKeys
*/
mapKeys(
object: object | null | undefined,
iteratee?: ObjectIteratee<any>
): Dictionary<any>;
mapKeys<T extends object>(
object: T | null | undefined,
iteratee?: ObjectIteratee<T>
): Dictionary<T[keyof T]>;
}
interface LoDashImplicitWrapper<TValue> {
@@ -2236,18 +2228,10 @@ declare module "../index" {
/**
* @see _.mapKeys
*/
mapKeys<T>(
this: LoDashImplicitWrapper<Dictionary<T> | null | undefined>,
iteratee?: DictionaryIteratee<T>
): LoDashImplicitWrapper<Dictionary<T>>;
/**
* @see _.mapKeys
*/
mapKeys(
this: LoDashImplicitWrapper<object | null | undefined>,
iteratee?: ObjectIteratee<any>
): LoDashImplicitWrapper<Dictionary<any>>;
mapKeys<T extends object>(
this: LoDashImplicitWrapper<T | null | undefined>,
iteratee?: ObjectIteratee<T>
): LoDashImplicitWrapper<Dictionary<T[keyof T]>>;
}
interface LoDashExplicitWrapper<TValue> {
@@ -2262,18 +2246,10 @@ declare module "../index" {
/**
* @see _.mapKeys
*/
mapKeys<T>(
this: LoDashExplicitWrapper<Dictionary<T> | null | undefined>,
iteratee?: DictionaryIteratee<T>
): LoDashExplicitWrapper<Dictionary<T>>;
/**
* @see _.mapKeys
*/
mapKeys(
this: LoDashExplicitWrapper<object | null | undefined>,
iteratee?: ObjectIteratee<any>
): LoDashExplicitWrapper<Dictionary<any>>;
mapKeys<T extends object>(
this: LoDashExplicitWrapper<T | null | undefined>,
iteratee?: ObjectIteratee<T>
): LoDashExplicitWrapper<Dictionary<T[keyof T]>>;
}
// mapValues
@@ -2298,8 +2274,27 @@ declare module "../index" {
* @param [thisArg] The `this` binding of `iteratee`.
* @return Returns the new mapped object.
*/
mapValues<TResult>(obj: string | null | undefined, callback: StringIterator<TResult>): NumericDictionary<TResult>;
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T, TResult>(obj: Dictionary<T> | NumericDictionary<T> | null | undefined, callback: ObjectIterator<Dictionary<T>, TResult>): Dictionary<TResult>;
/**
* @see _.mapValues
*/
mapValues<T extends object, TResult>(obj: T | null | undefined, callback: ObjectIterator<T, TResult>): { [P in keyof T]: TResult };
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T>(obj: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee: object): Dictionary<boolean>;
/**
* @see _.mapValues
*/
@@ -2307,23 +2302,34 @@ declare module "../index" {
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T, TKey extends keyof T>(obj: Dictionary<T> | null | undefined, iteratee: TKey): Dictionary<T[TKey]>;
mapValues<T, TKey extends keyof T>(obj: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee: TKey): Dictionary<T[TKey]>;
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T>(obj: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee: string): Dictionary<any>;
/**
* @see _.mapValues
*/
mapValues<T extends object, TKey extends keyof T>(obj: T | null | undefined, iteratee: string): { [P in keyof T]: any };
mapValues<T extends object>(obj: T | null | undefined, iteratee: string): { [P in keyof T]: any };
/**
* @see _.mapValues
*/
mapValues<TResult>(obj: string | null | undefined, callback: StringIterator<TResult>): NumericDictionary<TResult>;
mapValues(obj: string | null | undefined): NumericDictionary<string>;
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T>(obj: Dictionary<T> | null | undefined): Dictionary<T>;
mapValues<T>(obj: Dictionary<T> | NumericDictionary<T> | null | undefined): Dictionary<T>;
/**
* @see _.mapValues
@@ -2333,15 +2339,28 @@ declare module "../index" {
/**
* @see _.mapValues
*/
mapValues<T extends object>(obj: T | null | undefined): T | {};
/**
* @see _.mapValues
*/
mapValues(obj: string | null | undefined): NumericDictionary<string>;
mapValues<T extends object>(obj: T | null | undefined): PartialObject<T>;
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.mapValues
*/
mapValues<TResult>(
this: LoDashImplicitWrapper<string | null | undefined>,
callback: StringIterator<TResult>
): LoDashImplicitWrapper<NumericDictionary<TResult>>;
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T, TResult>(
this: LoDashImplicitWrapper<Dictionary<T> | NumericDictionary<T> | null | undefined>,
callback: ObjectIterator<Dictionary<T>, TResult>
): LoDashImplicitWrapper<Dictionary<TResult>>;
/**
* @see _.mapValues
*/
@@ -2350,6 +2369,16 @@ declare module "../index" {
callback: ObjectIterator<T, TResult>
): LoDashImplicitWrapper<{ [P in keyof T]: TResult }>;
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T>(
this: LoDashImplicitWrapper<Dictionary<T> | NumericDictionary<T> | null | undefined>,
iteratee: object
): LoDashImplicitWrapper<Dictionary<boolean>>;
/**
* @see _.mapValues
*/
@@ -2360,16 +2389,28 @@ declare module "../index" {
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T, TKey extends keyof T>(
this: LoDashImplicitWrapper<Dictionary<T> | null | undefined>,
this: LoDashImplicitWrapper<Dictionary<T> | NumericDictionary<T> | null | undefined>,
iteratee: TKey
): LoDashImplicitWrapper<Dictionary<T[TKey]>>;
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T extends object, TKey extends keyof T>(
mapValues<T>(
this: LoDashImplicitWrapper<Dictionary<T> | NumericDictionary<T> | null | undefined>,
iteratee: string
): LoDashImplicitWrapper<Dictionary<any>>;
/**
* @see _.mapValues
*/
mapValues<T extends object>(
this: LoDashImplicitWrapper<T | null | undefined>,
iteratee: string
): LoDashImplicitWrapper<{ [P in keyof T]: any }>;
@@ -2377,15 +2418,14 @@ declare module "../index" {
/**
* @see _.mapValues
*/
mapValues<TResult>(
this: LoDashImplicitWrapper<string | null | undefined>,
callback: StringIterator<TResult>
): LoDashImplicitWrapper<NumericDictionary<TResult>>;
mapValues(this: LoDashImplicitWrapper<string | null | undefined>): LoDashImplicitWrapper<NumericDictionary<string>>;
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T>(this: LoDashImplicitWrapper<Dictionary<T> | null | undefined>): LoDashImplicitWrapper<Dictionary<T>>;
mapValues<T>(this: LoDashImplicitWrapper<Dictionary<T> | NumericDictionary<T> | null | undefined>): LoDashImplicitWrapper<Dictionary<T>>;
/**
* @see _.mapValues
@@ -2395,15 +2435,28 @@ declare module "../index" {
/**
* @see _.mapValues
*/
mapValues<T extends object>(this: LoDashImplicitWrapper<T | null | undefined>): LoDashImplicitWrapper<T | {}>;
/**
* @see _.mapValues
*/
mapValues(this: LoDashImplicitWrapper<string | null | undefined>): LoDashImplicitWrapper<NumericDictionary<string>>;
mapValues<T extends object>(this: LoDashImplicitWrapper<T | null | undefined>): LoDashImplicitWrapper<PartialObject<T>>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.mapValues
*/
mapValues<TResult>(
this: LoDashExplicitWrapper<string | null | undefined>,
callback: StringIterator<TResult>
): LoDashExplicitWrapper<NumericDictionary<TResult>>;
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T, TResult>(
this: LoDashExplicitWrapper<Dictionary<T> | NumericDictionary<T> | null | undefined>,
callback: ObjectIterator<Dictionary<T>, TResult>
): LoDashExplicitWrapper<Dictionary<TResult>>;
/**
* @see _.mapValues
*/
@@ -2412,6 +2465,16 @@ declare module "../index" {
callback: ObjectIterator<T, TResult>
): LoDashExplicitWrapper<{ [P in keyof T]: TResult }>;
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T>(
this: LoDashExplicitWrapper<Dictionary<T> | NumericDictionary<T> | null | undefined>,
iteratee: object
): LoDashExplicitWrapper<Dictionary<boolean>>;
/**
* @see _.mapValues
*/
@@ -2422,16 +2485,28 @@ declare module "../index" {
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T, TKey extends keyof T>(
this: LoDashExplicitWrapper<Dictionary<T> | null | undefined>,
this: LoDashExplicitWrapper<Dictionary<T> | NumericDictionary<T> | null | undefined>,
iteratee: TKey
): LoDashExplicitWrapper<Dictionary<T[TKey]>>;
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T extends object, TKey extends keyof T>(
mapValues<T>(
this: LoDashExplicitWrapper<Dictionary<T> | NumericDictionary<T> | null | undefined>,
iteratee: string
): LoDashExplicitWrapper<Dictionary<any>>;
/**
* @see _.mapValues
*/
mapValues<T extends object>(
this: LoDashExplicitWrapper<T | null | undefined>,
iteratee: string
): LoDashExplicitWrapper<{ [P in keyof T]: any }>;
@@ -2439,15 +2514,14 @@ declare module "../index" {
/**
* @see _.mapValues
*/
mapValues<TResult>(
this: LoDashExplicitWrapper<string | null | undefined>,
callback: StringIterator<TResult>
): LoDashExplicitWrapper<NumericDictionary<TResult>>;
mapValues(this: LoDashExplicitWrapper<string | null | undefined>): LoDashExplicitWrapper<NumericDictionary<string>>;
/**
* @see _.mapValues
* TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary,
* but TypeScript cannot select overload signatures based on number vs string index key type.
*/
mapValues<T>(this: LoDashExplicitWrapper<Dictionary<T> | null | undefined>): LoDashExplicitWrapper<Dictionary<T>>;
mapValues<T>(this: LoDashExplicitWrapper<Dictionary<T> | NumericDictionary<T> | null | undefined>): LoDashExplicitWrapper<Dictionary<T>>;
/**
* @see _.mapValues
@@ -2457,12 +2531,7 @@ declare module "../index" {
/**
* @see _.mapValues
*/
mapValues<T extends object>(this: LoDashExplicitWrapper<T | null | undefined>): LoDashExplicitWrapper<T | {}>;
/**
* @see _.mapValues
*/
mapValues(this: LoDashExplicitWrapper<string | null | undefined>): LoDashExplicitWrapper<NumericDictionary<string>>;
mapValues<T extends object>(this: LoDashExplicitWrapper<T | null | undefined>): LoDashExplicitWrapper<PartialObject<T>>;
}
// merge
@@ -2773,10 +2842,10 @@ declare module "../index" {
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
omit<T>(
object: Dictionary<T>,
omit<T extends AnyKindOfDictionary>(
object: T | null | undefined,
...paths: PropertyPath[]
): Dictionary<T>;
): T;
/**
* @see _.omit
@@ -2791,10 +2860,10 @@ declare module "../index" {
/**
* @see _.omit
*/
omit<T>(
this: LoDashImplicitWrapper<Dictionary<T>>,
omit<T extends AnyKindOfDictionary>(
this: LoDashImplicitWrapper<T | null | undefined>,
...paths: PropertyPath[]
): LoDashImplicitWrapper<Dictionary<T>>;
): LoDashImplicitWrapper<T>;
/**
* @see _.omit
@@ -2809,10 +2878,10 @@ declare module "../index" {
/**
* @see _.omit
*/
omit<T>(
this: LoDashExplicitWrapper<Dictionary<T>>,
omit<T extends AnyKindOfDictionary>(
this: LoDashExplicitWrapper<T | null | undefined>,
...paths: PropertyPath[]
): LoDashExplicitWrapper<Dictionary<T>>;
): LoDashExplicitWrapper<T>;
/**
* @see _.omit
@@ -3164,7 +3233,7 @@ declare module "../index" {
* @param object The object to query.
* @return Returns the new array of key-value pairs.
*/
toPairs<T>(object?: Dictionary<T>): Array<[string, T]>;
toPairs<T>(object?: Dictionary<T> | NumericDictionary<T>): Array<[string, T]>;
/**
* @see _.toPairs
@@ -3176,7 +3245,7 @@ declare module "../index" {
/**
* @see _.toPairs
*/
toPairs<T>(this: LoDashImplicitWrapper<Dictionary<T>>): LoDashImplicitWrapper<Array<[string, T]>>;
toPairs<T>(this: LoDashImplicitWrapper<Dictionary<T> | NumericDictionary<T>>): LoDashImplicitWrapper<Array<[string, T]>>;
/**
* @see _.toPairs
@@ -3188,7 +3257,7 @@ declare module "../index" {
/**
* @see _.toPairs
*/
toPairs<T>(this: LoDashExplicitWrapper<Dictionary<T>>): LoDashExplicitWrapper<Array<[string, T]>>;
toPairs<T>(this: LoDashExplicitWrapper<Dictionary<T> | NumericDictionary<T>>): LoDashExplicitWrapper<Array<[string, T]>>;
/**
* @see _.toPairs
@@ -3205,7 +3274,7 @@ declare module "../index" {
* @param object The object to query.
* @return Returns the new array of key-value pairs.
*/
toPairsIn<T>(object?: Dictionary<T>): Array<[string, T]>;
toPairsIn<T>(object?: Dictionary<T> | NumericDictionary<T>): Array<[string, T]>;
/**
* @see _.toPairsIn
@@ -3217,7 +3286,7 @@ declare module "../index" {
/**
* @see _.toPairsIn
*/
toPairsIn<T>(this: LoDashImplicitWrapper<Dictionary<T>>): LoDashImplicitWrapper<Array<[string, T]>>;
toPairsIn<T>(this: LoDashImplicitWrapper<Dictionary<T> | NumericDictionary<T>>): LoDashImplicitWrapper<Array<[string, T]>>;
/**
* @see _.toPairsIn
@@ -3229,7 +3298,7 @@ declare module "../index" {
/**
* @see _.toPairsIn
*/
toPairsIn<T>(this: LoDashExplicitWrapper<Dictionary<T>>): LoDashExplicitWrapper<Array<[string, T]>>;
toPairsIn<T>(this: LoDashExplicitWrapper<Dictionary<T> | NumericDictionary<T>>): LoDashExplicitWrapper<Array<[string, T]>>;
/**
* @see _.toPairsIn
@@ -3563,7 +3632,7 @@ declare module "../index" {
* @param object The object to query.
* @return Returns an array of property values.
*/
values<T>(object: Dictionary<T>|NumericDictionary<T>|List<T> | null | undefined): T[];
values<T>(object: Dictionary<T> | NumericDictionary<T> | List<T> | null | undefined): T[];
/**
* @see _.values
+1378 -1088
View File
File diff suppressed because it is too large Load Diff