diff --git a/types/lodash/common/array.d.ts b/types/lodash/common/array.d.ts index 5591bce088..6d4aff3056 100644 --- a/types/lodash/common/array.d.ts +++ b/types/lodash/common/array.d.ts @@ -929,28 +929,28 @@ declare module "../index" { // flattenDepth interface LoDashStatic { - /** - * Recursively flatten array up to depth times. - * - * @param array The array to recursively flatten. - * @param number The maximum recursion depth. - * @return Returns the new flattened array. - */ - flattenDepth(array: ListOfRecursiveArraysOrValues | null | undefined, depth?: number): T[]; + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + flattenDepth(array: ListOfRecursiveArraysOrValues | null | undefined, depth?: number): T[]; } interface LoDashImplicitWrapper { - /** - * @see _.flattenDeep - */ - flattenDepth(this: LoDashImplicitWrapper | null | undefined>, depth?: number): LoDashImplicitWrapper; + /** + * @see _.flattenDeep + */ + flattenDepth(this: LoDashImplicitWrapper | null | undefined>, depth?: number): LoDashImplicitWrapper; } interface LoDashExplicitWrapper { - /** - * @see _.flattenDeep - */ - flattenDepth(this: LoDashExplicitWrapper | null | undefined>, depth?: number): LoDashExplicitWrapper; + /** + * @see _.flattenDeep + */ + flattenDepth(this: LoDashExplicitWrapper | null | undefined>, depth?: number): LoDashExplicitWrapper; } // fromPairs diff --git a/types/lodash/common/common.d.ts b/types/lodash/common/common.d.ts index 28c4437073..d0856a006b 100644 --- a/types/lodash/common/common.d.ts +++ b/types/lodash/common/common.d.ts @@ -217,6 +217,8 @@ declare module "../index" { type PropertyName = string | number | symbol; type PropertyPath = Many; + type Omit = Pick; + /** Common interface between Arrays and jQuery objects */ type List = ArrayLike; diff --git a/types/lodash/common/object.d.ts b/types/lodash/common/object.d.ts index e0b1f3ebf1..5e2d539c23 100644 --- a/types/lodash/common/object.d.ts +++ b/types/lodash/common/object.d.ts @@ -2860,15 +2860,23 @@ declare module "../index" { */ omit( object: T | null | undefined, - ...paths: PropertyPath[] + ...paths: Array> ): T; + /** + * @see _.omit + */ + omit( + object: T | null | undefined, + ...paths: Array> + ): Omit; + /** * @see _.omit */ omit( object: T | null | undefined, - ...paths: PropertyPath[] + ...paths: Array> ): PartialObject; } @@ -2878,15 +2886,23 @@ declare module "../index" { */ omit( this: LoDashImplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashImplicitWrapper; + /** + * @see _.omit + */ + omit( + this: LoDashImplicitWrapper, + ...paths: Array> + ): LoDashImplicitWrapper>; + /** * @see _.omit */ omit( this: LoDashImplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashImplicitWrapper>; } @@ -2896,15 +2912,23 @@ declare module "../index" { */ omit( this: LoDashExplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashExplicitWrapper; + /** + * @see _.omit + */ + omit( + this: LoDashExplicitWrapper, + ...paths: Array> + ): LoDashExplicitWrapper>; + /** * @see _.omit */ omit( this: LoDashExplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashExplicitWrapper>; } diff --git a/types/lodash/fp.d.ts b/types/lodash/fp.d.ts index d577414aa4..da68ea250e 100644 --- a/types/lodash/fp.d.ts +++ b/types/lodash/fp.d.ts @@ -1,6 +1,6 @@ // AUTO-GENERATED: do not modify this file directly. // If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: -// npm run fp +// npm install && npm run generate import lodash = require("./index"); @@ -60,7 +60,14 @@ declare namespace _ { } type LodashAssign1x1 = (source: TSource) => TObject & TSource; type LodashAssign1x2 = (object: TObject) => TObject & TSource; - type LodashAssignAll = (object: ReadonlyArray) => any; + interface LodashAssignAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: [TObject]): TObject; + (object: ReadonlyArray): any; + } interface LodashAssignAllWith { (customizer: lodash.AssignCustomizer): LodashAssignAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashAssignAllWith1x2; @@ -75,7 +82,14 @@ declare namespace _ { } type LodashAssignIn1x1 = (source: TSource) => TObject & TSource; type LodashAssignIn1x2 = (object: TObject) => TObject & TSource; - type LodashAssignInAll = (object: ReadonlyArray) => TResult; + interface LodashAssignInAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: [TObject]): TObject; + (object: ReadonlyArray): TResult; + } interface LodashAssignInAllWith { (customizer: lodash.AssignCustomizer): LodashAssignInAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashAssignInAllWith1x2; @@ -453,7 +467,14 @@ declare namespace _ { } type LodashDefaults1x1 = (object: TObject) => TSource & TObject; type LodashDefaults1x2 = (source: TSource) => TSource & TObject; - type LodashDefaultsAll = (object: ReadonlyArray) => any; + interface LodashDefaultsAll { + (object: [TObject, TSource]): TSource & TObject; + (object: [TObject, TSource1, TSource2]): TSource2 & TSource1 & TObject; + (object: [TObject, TSource1, TSource2, TSource3]): TSource3 & TSource2 & TSource1 & TObject; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TSource4 & TSource3 & TSource2 & TSource1 & TObject; + (object: [TObject]): TObject; + (object: ReadonlyArray): any; + } interface LodashDefaultsDeep { (sources: any): LodashDefaultsDeep1x1; (sources: lodash.__, object: any): LodashDefaultsDeep1x2; @@ -546,11 +567,11 @@ declare namespace _ { type LodashDifferenceWith1x6 = (comparator: lodash.Comparator2) => T1[]; interface LodashUnset { (path: lodash.PropertyPath): LodashUnset1x1; - (path: lodash.__, object: any): LodashUnset1x2; - (path: lodash.PropertyPath, object: any): boolean; + (path: lodash.__, object: T): LodashUnset1x2; + (path: lodash.PropertyPath, object: T): T; } - type LodashUnset1x1 = (object: any) => boolean; - type LodashUnset1x2 = (path: lodash.PropertyPath) => boolean; + type LodashUnset1x1 = (object: T) => T; + type LodashUnset1x2 = (path: lodash.PropertyPath) => T; interface LodashDivide { (dividend: number): LodashDivide1x1; (dividend: lodash.__, divisor: number): LodashDivide1x2; @@ -704,7 +725,14 @@ declare namespace _ { } type LodashExtend1x1 = (source: TSource) => TObject & TSource; type LodashExtend1x2 = (object: TObject) => TObject & TSource; - type LodashExtendAll = (object: ReadonlyArray) => TResult; + interface LodashExtendAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: [TObject]): TObject; + (object: ReadonlyArray): TResult; + } interface LodashExtendAllWith { (customizer: lodash.AssignCustomizer): LodashExtendAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashExtendAllWith1x2; @@ -2171,7 +2199,13 @@ declare namespace _ { } type LodashMerge1x1 = (source: TSource) => TObject & TSource; type LodashMerge1x2 = (object: TObject) => TObject & TSource; - type LodashMergeAll = (object: ReadonlyArray) => any; + interface LodashMergeAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: ReadonlyArray): any; + } interface LodashMergeAllWith { (customizer: lodash.MergeWithCustomizer): LodashMergeAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashMergeAllWith1x2; @@ -2235,18 +2269,24 @@ declare namespace _ { type LodashNth1x2 = (n: number) => T | undefined; type LodashNthArg = (n: number) => (...args: any[]) => any; interface LodashOmit { - (paths: lodash.PropertyPath): LodashOmit1x1; + (paths: lodash.Many): LodashOmit1x1; (paths: lodash.__, object: T | null | undefined): LodashOmit1x2; - (paths: lodash.PropertyPath, object: T | null | undefined): T; + (paths: lodash.Many, object: T | null | undefined): T; + (paths: lodash.Many): LodashOmit2x1; (paths: lodash.__, object: T | null | undefined): LodashOmit2x2; - (paths: lodash.PropertyPath, object: T | null | undefined): lodash.PartialObject; + (paths: lodash.Many, object: T | null | undefined): lodash.Omit; + (paths: lodash.Many, object: T | null | undefined): lodash.PartialObject; } interface LodashOmit1x1 { (object: T | null | undefined): T; (object: T | null | undefined): lodash.PartialObject; } - type LodashOmit1x2 = (paths: lodash.PropertyPath) => T; - type LodashOmit2x2 = (paths: lodash.PropertyPath) => lodash.PartialObject; + type LodashOmit1x2 = (paths: lodash.Many) => T; + type LodashOmit2x1 = (object: T | null | undefined) => lodash.Omit; + interface LodashOmit2x2 { + (paths: lodash.Many): lodash.Omit; + (paths: lodash.Many): lodash.PartialObject; + } interface LodashOmitBy { (predicate: lodash.ValueKeyIteratee): LodashOmitBy1x1; (predicate: lodash.__, object: T | null | undefined): LodashOmitBy1x2; @@ -2435,21 +2475,252 @@ declare namespace _ { type LodashParseInt1x1 = (string: string) => number; type LodashParseInt1x2 = (radix: number) => number; interface LodashPartial { - (args: ReadonlyArray): LodashPartial1x1; - (args: lodash.__, func: (...args: any[]) => any): LodashPartial1x2; - (args: ReadonlyArray, func: (...args: any[]) => any): (...args: any[]) => any; + (func: lodash.Function1): LodashPartial1x1; + (func: lodash.__, arg1: [T1]): LodashPartial1x2; + (func: lodash.Function1, arg1: [T1]): lodash.Function0; + (func: lodash.Function2): LodashPartial2x1; + (func: lodash.Function2, arg1: [T1]): lodash.Function1< T2, R>; + (func: lodash.__, plc1: [lodash.__, T2]): LodashPartial3x2; + (func: lodash.Function2, plc1: [lodash.__, T2]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2]): LodashPartial4x2; + (func: lodash.Function2, arg1: [T1, T2]): lodash.Function0< R>; + (func: lodash.Function3): LodashPartial5x1; + (func: lodash.Function3, arg1: [T1]): lodash.Function2< T2, T3, R>; + (func: lodash.Function3, plc1: [lodash.__, T2]): lodash.Function2; + (func: lodash.Function3, arg1: [T1, T2]): lodash.Function1< T3, R>; + (func: lodash.__, plc1: [lodash.__, lodash.__, T3]): LodashPartial8x2; + (func: lodash.Function3, plc1: [lodash.__, lodash.__, T3]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3]): LodashPartial9x2; + (func: lodash.Function3, arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (func: lodash.__, plc1: [lodash.__, T2, T3]): LodashPartial10x2; + (func: lodash.Function3, plc1: [lodash.__, T2, T3]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3]): LodashPartial11x2; + (func: lodash.Function3, arg1: [T1, T2, T3]): lodash.Function0< R>; + (func: lodash.Function4): LodashPartial12x1; + (func: lodash.Function4, arg1: [T1]): lodash.Function3< T2, T3, T4, R>; + (func: lodash.Function4, plc1: [lodash.__, T2]): lodash.Function3; + (func: lodash.Function4, arg1: [T1, T2]): lodash.Function2< T3, T4, R>; + (func: lodash.Function4, plc1: [lodash.__, lodash.__, T3]): lodash.Function3; + (func: lodash.Function4, arg1: [T1, lodash.__, T3]): lodash.Function2< T2, T4, R>; + (func: lodash.Function4, plc1: [lodash.__, T2, T3]): lodash.Function2; + (func: lodash.Function4, arg1: [T1, T2, T3]): lodash.Function1< T4, R>; + (func: lodash.__, plc1: [lodash.__, lodash.__, lodash.__, T4]): LodashPartial19x2; + (func: lodash.Function4, plc1: [lodash.__, lodash.__, lodash.__, T4]): lodash.Function3; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__, T4]): LodashPartial20x2; + (func: lodash.Function4, arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (func: lodash.__, plc1: [lodash.__, T2, lodash.__, T4]): LodashPartial21x2; + (func: lodash.Function4, plc1: [lodash.__, T2, lodash.__, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, lodash.__, T4]): LodashPartial22x2; + (func: lodash.Function4, arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (func: lodash.__, plc1: [lodash.__, lodash.__, T3, T4]): LodashPartial23x2; + (func: lodash.Function4, plc1: [lodash.__, lodash.__, T3, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3, T4]): LodashPartial24x2; + (func: lodash.Function4, arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (func: lodash.__, plc1: [lodash.__, T2, T3, T4]): LodashPartial25x2; + (func: lodash.Function4, plc1: [lodash.__, T2, T3, T4]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3, T4]): LodashPartial26x2; + (func: lodash.Function4, arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + (func: (...args: any[]) => any): LodashPartial27x1; + (func: lodash.__, args: ReadonlyArray): LodashPartial27x2; + (func: (...args: any[]) => any, args: ReadonlyArray): (...args: any[]) => any; placeholder: lodash.__; } - type LodashPartial1x1 = (func: (...args: any[]) => any) => (...args: any[]) => any; - type LodashPartial1x2 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartial1x1 = (arg1: [T1]) => lodash.Function0; + interface LodashPartial1x2 { + (func: lodash.Function1): lodash.Function0; + (func: lodash.Function2): lodash.Function1< T2, R>; + (func: lodash.Function3): lodash.Function2< T2, T3, R>; + (func: lodash.Function4): lodash.Function3< T2, T3, T4, R>; + } + interface LodashPartial2x1 { + (arg1: [T1]): lodash.Function1< T2, R>; + (plc1: [lodash.__, T2]): lodash.Function1; + (arg1: [T1, T2]): lodash.Function0< R>; + } + interface LodashPartial3x2 { + (func: lodash.Function2): lodash.Function1; + (func: lodash.Function3): lodash.Function2; + (func: lodash.Function4): lodash.Function3; + } + interface LodashPartial4x2 { + (func: lodash.Function2): lodash.Function0< R>; + (func: lodash.Function3): lodash.Function1< T3, R>; + (func: lodash.Function4): lodash.Function2< T3, T4, R>; + } + interface LodashPartial5x1 { + (arg1: [T1]): lodash.Function2< T2, T3, R>; + (plc1: [lodash.__, T2]): lodash.Function2; + (arg1: [T1, T2]): lodash.Function1< T3, R>; + (plc1: [lodash.__, lodash.__, T3]): lodash.Function2; + (arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (plc1: [lodash.__, T2, T3]): lodash.Function1; + (arg1: [T1, T2, T3]): lodash.Function0< R>; + } + interface LodashPartial8x2 { + (func: lodash.Function3): lodash.Function2; + (func: lodash.Function4): lodash.Function3; + } + interface LodashPartial9x2 { + (func: lodash.Function3): lodash.Function1< T2, R>; + (func: lodash.Function4): lodash.Function2< T2, T4, R>; + } + interface LodashPartial10x2 { + (func: lodash.Function3): lodash.Function1; + (func: lodash.Function4): lodash.Function2; + } + interface LodashPartial11x2 { + (func: lodash.Function3): lodash.Function0< R>; + (func: lodash.Function4): lodash.Function1< T4, R>; + } + interface LodashPartial12x1 { + (arg1: [T1]): lodash.Function3< T2, T3, T4, R>; + (plc1: [lodash.__, T2]): lodash.Function3; + (arg1: [T1, T2]): lodash.Function2< T3, T4, R>; + (plc1: [lodash.__, lodash.__, T3]): lodash.Function3; + (arg1: [T1, lodash.__, T3]): lodash.Function2< T2, T4, R>; + (plc1: [lodash.__, T2, T3]): lodash.Function2; + (arg1: [T1, T2, T3]): lodash.Function1< T4, R>; + (plc1: [lodash.__, lodash.__, lodash.__, T4]): lodash.Function3; + (arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (plc1: [lodash.__, T2, lodash.__, T4]): lodash.Function2; + (arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (plc1: [lodash.__, lodash.__, T3, T4]): lodash.Function2; + (arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (plc1: [lodash.__, T2, T3, T4]): lodash.Function1; + (arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + } + type LodashPartial19x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartial20x2 = (func: lodash.Function4) => lodash.Function2< T2, T3, R>; + type LodashPartial21x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartial22x2 = (func: lodash.Function4) => lodash.Function1< T3, R>; + type LodashPartial23x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartial24x2 = (func: lodash.Function4) => lodash.Function1< T2, R>; + type LodashPartial25x2 = (func: lodash.Function4) => lodash.Function1; + type LodashPartial26x2 = (func: lodash.Function4) => lodash.Function0< R>; + type LodashPartial27x1 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartial27x2 = (func: (...args: any[]) => any) => (...args: any[]) => any; interface LodashPartialRight { - (args: ReadonlyArray): LodashPartialRight1x1; - (args: lodash.__, func: (...args: any[]) => any): LodashPartialRight1x2; - (args: ReadonlyArray, func: (...args: any[]) => any): (...args: any[]) => any; + (func: lodash.Function1): LodashPartialRight1x1; + (func: lodash.__, arg1: [T1]): LodashPartialRight1x2; + (func: lodash.Function1, arg1: [T1]): lodash.Function0; + (func: lodash.Function2): LodashPartialRight2x1; + (func: lodash.__, arg1: [T1, lodash.__]): LodashPartialRight2x2; + (func: lodash.Function2, arg1: [T1, lodash.__]): lodash.Function1< T2, R>; + (func: lodash.__, arg2: [T2]): LodashPartialRight3x2; + (func: lodash.Function2, arg2: [T2]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2]): LodashPartialRight4x2; + (func: lodash.Function2, arg1: [T1, T2]): lodash.Function0< R>; + (func: lodash.Function3): LodashPartialRight5x1; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__]): LodashPartialRight5x2; + (func: lodash.Function3, arg1: [T1, lodash.__, lodash.__]): lodash.Function2< T2, T3, R>; + (func: lodash.__, arg2: [T2, lodash.__]): LodashPartialRight6x2; + (func: lodash.Function3, arg2: [T2, lodash.__]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, lodash.__]): LodashPartialRight7x2; + (func: lodash.Function3, arg1: [T1, T2, lodash.__]): lodash.Function1< T3, R>; + (func: lodash.__, arg3: [T3]): LodashPartialRight8x2; + (func: lodash.Function3, arg3: [T3]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3]): LodashPartialRight9x2; + (func: lodash.Function3, arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (func: lodash.__, arg2: [T2, T3]): LodashPartialRight10x2; + (func: lodash.Function3, arg2: [T2, T3]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3]): LodashPartialRight11x2; + (func: lodash.Function3, arg1: [T1, T2, T3]): lodash.Function0< R>; + (func: lodash.Function4): LodashPartialRight12x1; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__, lodash.__]): LodashPartialRight12x2; + (func: lodash.Function4, arg1: [T1, lodash.__, lodash.__, lodash.__]): lodash.Function3< T2, T3, T4, R>; + (func: lodash.__, arg2: [T2, lodash.__, lodash.__]): LodashPartialRight13x2; + (func: lodash.Function4, arg2: [T2, lodash.__, lodash.__]): lodash.Function3; + (func: lodash.__, arg1: [T1, T2, lodash.__, lodash.__]): LodashPartialRight14x2; + (func: lodash.Function4, arg1: [T1, T2, lodash.__, lodash.__]): lodash.Function2< T3, T4, R>; + (func: lodash.__, arg3: [T3, lodash.__]): LodashPartialRight15x2; + (func: lodash.Function4, arg3: [T3, lodash.__]): lodash.Function3; + (func: lodash.__, arg1: [T1, lodash.__, T3, lodash.__]): LodashPartialRight16x2; + (func: lodash.Function4, arg1: [T1, lodash.__, T3, lodash.__]): lodash.Function2< T2, T4, R>; + (func: lodash.__, arg2: [T2, T3, lodash.__]): LodashPartialRight17x2; + (func: lodash.Function4, arg2: [T2, T3, lodash.__]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, T3, lodash.__]): LodashPartialRight18x2; + (func: lodash.Function4, arg1: [T1, T2, T3, lodash.__]): lodash.Function1< T4, R>; + (func: lodash.__, arg4: [T4]): LodashPartialRight19x2; + (func: lodash.Function4, arg4: [T4]): lodash.Function3; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__, T4]): LodashPartialRight20x2; + (func: lodash.Function4, arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (func: lodash.__, arg2: [T2, lodash.__, T4]): LodashPartialRight21x2; + (func: lodash.Function4, arg2: [T2, lodash.__, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, lodash.__, T4]): LodashPartialRight22x2; + (func: lodash.Function4, arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (func: lodash.__, arg3: [T3, T4]): LodashPartialRight23x2; + (func: lodash.Function4, arg3: [T3, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3, T4]): LodashPartialRight24x2; + (func: lodash.Function4, arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (func: lodash.__, arg2: [T2, T3, T4]): LodashPartialRight25x2; + (func: lodash.Function4, arg2: [T2, T3, T4]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3, T4]): LodashPartialRight26x2; + (func: lodash.Function4, arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + (func: (...args: any[]) => any): LodashPartialRight27x1; + (func: lodash.__, args: ReadonlyArray): LodashPartialRight27x2; + (func: (...args: any[]) => any, args: ReadonlyArray): (...args: any[]) => any; placeholder: lodash.__; } - type LodashPartialRight1x1 = (func: (...args: any[]) => any) => (...args: any[]) => any; - type LodashPartialRight1x2 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartialRight1x1 = (arg1: [T1]) => lodash.Function0; + type LodashPartialRight1x2 = (func: lodash.Function1) => lodash.Function0; + interface LodashPartialRight2x1 { + (arg1: [T1, lodash.__]): lodash.Function1< T2, R>; + (arg2: [T2]): lodash.Function1; + (arg1: [T1, T2]): lodash.Function0< R>; + } + type LodashPartialRight2x2 = (func: lodash.Function2) => lodash.Function1< T2, R>; + type LodashPartialRight3x2 = (func: lodash.Function2) => lodash.Function1; + type LodashPartialRight4x2 = (func: lodash.Function2) => lodash.Function0< R>; + interface LodashPartialRight5x1 { + (arg1: [T1, lodash.__, lodash.__]): lodash.Function2< T2, T3, R>; + (arg2: [T2, lodash.__]): lodash.Function2; + (arg1: [T1, T2, lodash.__]): lodash.Function1< T3, R>; + (arg3: [T3]): lodash.Function2; + (arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (arg2: [T2, T3]): lodash.Function1; + (arg1: [T1, T2, T3]): lodash.Function0< R>; + } + type LodashPartialRight5x2 = (func: lodash.Function3) => lodash.Function2< T2, T3, R>; + type LodashPartialRight6x2 = (func: lodash.Function3) => lodash.Function2; + type LodashPartialRight7x2 = (func: lodash.Function3) => lodash.Function1< T3, R>; + type LodashPartialRight8x2 = (func: lodash.Function3) => lodash.Function2; + type LodashPartialRight9x2 = (func: lodash.Function3) => lodash.Function1< T2, R>; + type LodashPartialRight10x2 = (func: lodash.Function3) => lodash.Function1; + type LodashPartialRight11x2 = (func: lodash.Function3) => lodash.Function0< R>; + interface LodashPartialRight12x1 { + (arg1: [T1, lodash.__, lodash.__, lodash.__]): lodash.Function3< T2, T3, T4, R>; + (arg2: [T2, lodash.__, lodash.__]): lodash.Function3; + (arg1: [T1, T2, lodash.__, lodash.__]): lodash.Function2< T3, T4, R>; + (arg3: [T3, lodash.__]): lodash.Function3; + (arg1: [T1, lodash.__, T3, lodash.__]): lodash.Function2< T2, T4, R>; + (arg2: [T2, T3, lodash.__]): lodash.Function2; + (arg1: [T1, T2, T3, lodash.__]): lodash.Function1< T4, R>; + (arg4: [T4]): lodash.Function3; + (arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (arg2: [T2, lodash.__, T4]): lodash.Function2; + (arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (arg3: [T3, T4]): lodash.Function2; + (arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (arg2: [T2, T3, T4]): lodash.Function1; + (arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + } + type LodashPartialRight12x2 = (func: lodash.Function4) => lodash.Function3< T2, T3, T4, R>; + type LodashPartialRight13x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartialRight14x2 = (func: lodash.Function4) => lodash.Function2< T3, T4, R>; + type LodashPartialRight15x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartialRight16x2 = (func: lodash.Function4) => lodash.Function2< T2, T4, R>; + type LodashPartialRight17x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartialRight18x2 = (func: lodash.Function4) => lodash.Function1< T4, R>; + type LodashPartialRight19x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartialRight20x2 = (func: lodash.Function4) => lodash.Function2< T2, T3, R>; + type LodashPartialRight21x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartialRight22x2 = (func: lodash.Function4) => lodash.Function1< T3, R>; + type LodashPartialRight23x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartialRight24x2 = (func: lodash.Function4) => lodash.Function1< T2, R>; + type LodashPartialRight25x2 = (func: lodash.Function4) => lodash.Function1; + type LodashPartialRight26x2 = (func: lodash.Function4) => lodash.Function0< R>; + type LodashPartialRight27x1 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartialRight27x2 = (func: (...args: any[]) => any) => (...args: any[]) => any; interface LodashPartition { (callback: lodash.ValueIteratee): LodashPartition1x1; (callback: lodash.__, collection: lodash.List | null | undefined): LodashPartition1x2; @@ -4055,7 +4326,13 @@ declare namespace _ { } type LodashZip1x1 = (arrays2: lodash.List) => Array<[T1 | undefined, T2 | undefined]>; type LodashZip1x2 = (arrays1: lodash.List) => Array<[T1 | undefined, T2 | undefined]>; - type LodashZipAll = (arrays: ReadonlyArray | null | undefined>) => Array>; + interface LodashZipAll { + (arrays1: [lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined]>; + (arrays1: [lodash.List, lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined, T3 | undefined]>; + (arrays1: [lodash.List, lodash.List, lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined]>; + (arrays1: [lodash.List, lodash.List, lodash.List, lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined, T5 | undefined]>; + (arrays: ReadonlyArray | null | undefined>): Array>; + } interface LodashZipObject { (props: lodash.List): LodashZipObject1x1; (props: lodash.__, values: lodash.List): LodashZipObject1x2; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index fbb164c4c5..88a5a88bfc 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -9,6 +9,20 @@ interface AbcObject { c: boolean; } +const abcObject: AbcObject = anything; +const array: AbcObject[] | null | undefined = anything; +const list: _.List | null | undefined = anything; +const dictionary: _.Dictionary | null | undefined = anything; +const numericDictionary: _.NumericDictionary | null | undefined = anything; +const arrayParam: AbcObject[] = []; +const listParam: _.List = []; +const comparator = (a: AbcObject, b: AbcObject) => true; +const listIterator = (value: AbcObject, index: number, collection: _.List) => true; +const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; +const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; +const valueIterator = (value: AbcObject) => true; +const stringIterator = (value: string) => ""; + // Wrapped array shortcut methods _([1, 2, 3, 4]).pop(); // $ExpectType number | undefined _([1, 2, 3, 4]).push(5, 6, 7); // $ExpectType LoDashImplicitWrapper @@ -32,8 +46,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.chunk(list); // $ExpectType AbcObject[][] _.chunk(list, 42); // $ExpectType AbcObject[][] @@ -60,10 +72,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const arrayParam: AbcObject[] = []; - const listParam: _.List = []; - _.difference(list); // $ExpectType AbcObject[] _.difference(list, listParam); // $ExpectType AbcObject[] _.difference(list, listParam, arrayParam, listParam); // $ExpectType AbcObject[] @@ -82,19 +90,14 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const arrayParam: AbcObject[] = []; - const listParam: _.List = []; - const iteratee = (value: AbcObject) => 1; - _.differenceBy(list); // $ExpectType AbcObject[] _.differenceBy(list, listParam); // $ExpectType AbcObject[] _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType AbcObject[] - _.differenceBy(list, listParam, iteratee); // $ExpectType AbcObject[] - _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, valueIterator); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); // $ExpectType AbcObject[] // $ExpectType AbcObject[] - _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); + _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); _.differenceBy(list, listParam, "a"); // $ExpectType AbcObject[] _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType AbcObject[] @@ -109,10 +112,10 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType LoDashImplicitWrapper - _(list).differenceBy(listParam, iteratee); // $ExpectType LoDashImplicitWrapper - _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, valueIterator); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper - _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); + _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); _(list).differenceBy(listParam, "a"); // $ExpectType LoDashImplicitWrapper _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType LoDashImplicitWrapper @@ -127,10 +130,10 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceBy(arrayParam, iteratee); // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, valueIterator); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); + _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, valueIterator); _.chain(list).differenceBy(arrayParam, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, "a"); // $ExpectType LoDashExplicitWrapper @@ -142,8 +145,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - fp.differenceBy(iteratee, list, arrayParam); // $ExpectType AbcObject[] - fp.differenceBy(iteratee)(list)(listParam); // $ExpectType AbcObject[] + fp.differenceBy(valueIterator, list, arrayParam); // $ExpectType AbcObject[] + fp.differenceBy(valueIterator)(list)(listParam); // $ExpectType AbcObject[] fp.differenceBy("a", list, arrayParam); // $ExpectType AbcObject[] fp.differenceBy({a: 1}, list, arrayParam); // $ExpectType AbcObject[] @@ -188,21 +191,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper { - value; // $ExpectType T1 | T2 | T3 - return 0; - }); - // $ExpectType T1[] - _.differenceBy([t1], [t2], [t3], [t4], (value) => { - value; // $ExpectType T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType T1[] - _.differenceBy([t1], [t2], [t3], [t4], [""], (value) => { - value; // $ExpectType string | T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType T1[] _.differenceBy([t1], [t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; @@ -226,21 +214,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _([t1]).differenceBy([t2], [t3], (value) => { - value; // $ExpectType T1 | T2 | T3 - return 0; - }); - // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], [t3], [t4], (value) => { - value; // $ExpectType T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], [t3], [t4], [""], (value) => { - value; // $ExpectType string | T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashImplicitWrapper _([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; @@ -264,21 +237,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], (value) => { - value; // $ExpectType T1 | T2 | T3 - return 0; - }); - // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], [t4], (value) => { - value; // $ExpectType T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], [t4], [""], (value) => { - value; // $ExpectType string | T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashExplicitWrapper _.chain([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; @@ -292,24 +250,13 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = [] as any; - const arrayParam: AbcObject[] = []; - const listParam: _.List = []; - const comparator = (a: AbcObject, b: AbcObject) => true; - _.differenceWith(list); // $ExpectType AbcObject[] - _.differenceWith(list, arrayParam); // $ExpectType AbcObject[] - _.differenceWith(list, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType AbcObject[] _.differenceWith(list, arrayParam, comparator); // $ExpectType AbcObject[] _.differenceWith(list, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType AbcObject[] - _(list).differenceWith(arrayParam); // $ExpectType LoDashImplicitWrapper - _(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashImplicitWrapper _(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashImplicitWrapper _(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashImplicitWrapper - _.chain(list).differenceWith(arrayParam); // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashExplicitWrapper @@ -359,8 +306,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.drop(list); // $ExpectType AbcObject[] _.drop(list, 42); // $ExpectType AbcObject[] _(list).drop(42); // $ExpectType LoDashImplicitWrapper @@ -381,145 +326,132 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - const predicateFn2 = (value: AbcObject) => true; - _.dropWhile(list); // $ExpectType AbcObject[] - _.dropWhile(list, predicateFn); // $ExpectType AbcObject[] + _.dropWhile(list, listIterator); // $ExpectType AbcObject[] _.dropWhile(list, ""); // $ExpectType AbcObject[] _.dropWhile(list, {a: 42}); // $ExpectType AbcObject[] _(list).dropWhile(); // $ExpectType LoDashImplicitWrapper - _(list).dropWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).dropWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).dropWhile(""); // $ExpectType LoDashImplicitWrapper _(list).dropWhile({a: 42}); // $ExpectType LoDashImplicitWrapper _.chain(list).dropWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).dropWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).dropWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).dropWhile({a: 42}); // $ExpectType LoDashExplicitWrapper - fp.dropWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.dropWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.dropWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.dropWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.dropWhile("", list); // $ExpectType AbcObject[] fp.dropWhile({ a: 42 }, list); // $ExpectType AbcObject[] _.dropRightWhile(list); // $ExpectType AbcObject[] - _.dropRightWhile(list, predicateFn); // $ExpectType AbcObject[] + _.dropRightWhile(list, listIterator); // $ExpectType AbcObject[] _.dropRightWhile(list, ""); // $ExpectType AbcObject[] _.dropRightWhile(list, {a: 42}); // $ExpectType AbcObject[] _(list).dropRightWhile(); // $ExpectType LoDashImplicitWrapper - _(list).dropRightWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).dropRightWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).dropRightWhile(""); // $ExpectType LoDashImplicitWrapper _(list).dropRightWhile({a: 42}); // $ExpectType LoDashImplicitWrapper _.chain(list).dropRightWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).dropRightWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropRightWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).dropRightWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).dropRightWhile({a: 42}); // $ExpectType LoDashExplicitWrapper - fp.dropRightWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.dropRightWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.dropRightWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.dropRightWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.dropRightWhile("", list); // $ExpectType AbcObject[] fp.dropRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.fill { - const array: number[] | null | undefined = anything; - const list: _.List | null | undefined = anything; + _.fill(array, abcObject); // $ExpectType AbcObject[] + _.fill(array, abcObject, 0); // $ExpectType AbcObject[] + _.fill(array, abcObject, 0, 10); // $ExpectType AbcObject[] - _.fill(array, 42); // $ExpectType number[] - _.fill(array, 42, 0); // $ExpectType number[] - _.fill(array, 42, 0, 10); // $ExpectType number[] + _.fill(list, abcObject); // $ExpectType ArrayLike + _.fill(list, abcObject, 0); // $ExpectType ArrayLike + _.fill(list, abcObject, 0, 10); // $ExpectType ArrayLike - _.fill(list, 42); // $ExpectType ArrayLike - _.fill(list, 42, 0); // $ExpectType ArrayLike - _.fill(list, 42, 0, 10); // $ExpectType ArrayLike + _(list).fill(abcObject); // $ExpectType LoDashImplicitWrapper> + _(list).fill(abcObject, 0); // $ExpectType LoDashImplicitWrapper> + _(list).fill(abcObject, 0, 10); // $ExpectType LoDashImplicitWrapper> - _(list).fill(42); // $ExpectType LoDashImplicitWrapper> - _(list).fill(42, 0); // $ExpectType LoDashImplicitWrapper> - _(list).fill(42, 0, 10); // $ExpectType LoDashImplicitWrapper> + _.chain(list).fill(abcObject); // $ExpectType LoDashExplicitWrapper> + _.chain(list).fill(abcObject, 0); // $ExpectType LoDashExplicitWrapper> + _.chain(list).fill(abcObject, 0, 10); // $ExpectType LoDashExplicitWrapper> - _.chain(list).fill(42); // $ExpectType LoDashExplicitWrapper> - _.chain(list).fill(42, 0); // $ExpectType LoDashExplicitWrapper> - _.chain(list).fill(42, 0, 10); // $ExpectType LoDashExplicitWrapper> - - fp.fill(0, 10, 42, array); // $ExpectType number[] - fp.fill(0)(10)(42)(array); // $ExpectType number[] - fp.fill(0, 10, 42, list); // $ExpectType ArrayLike + fp.fill(0, 10, abcObject, array); // $ExpectType AbcObject[] + fp.fill(0)(10)(abcObject)(array); // $ExpectType AbcObject[] + fp.fill(0, 10, abcObject, list); // $ExpectType ArrayLike } // _.findIndex // _.findLastIndex { - const list: _.List | null | undefined = anything; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - const predicateFn2 = (value: AbcObject) => true; - _.findIndex(list); // $ExpectType number - _.findIndex(list, predicateFn); // $ExpectType number + _.findIndex(list, listIterator); // $ExpectType number _.findIndex(list, ""); // $ExpectType number _.findIndex(list, {a: 42}); // $ExpectType number - _.findIndex(list, predicateFn, 1); // $ExpectType number + _.findIndex(list, listIterator, 1); // $ExpectType number _(list).findIndex(); // $ExpectType number - _(list).findIndex(predicateFn); // $ExpectType number + _(list).findIndex(listIterator); // $ExpectType number _(list).findIndex(""); // $ExpectType number _(list).findIndex<{a: number}>({a: 42}); // $ExpectType number - _(list).findIndex(predicateFn, 1); // $ExpectType number + _(list).findIndex(listIterator, 1); // $ExpectType number _.chain(list).findIndex(); // $ExpectType LoDashExplicitWrapper - _.chain(list).findIndex(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).findIndex(""); // $ExpectType LoDashExplicitWrapper _.chain(list).findIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper - _.chain(list).findIndex(predicateFn, 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(listIterator, 1); // $ExpectType LoDashExplicitWrapper - fp.findIndex(predicateFn2, list); // $ExpectType number - fp.findIndex(predicateFn2)(list); // $ExpectType number + fp.findIndex(valueIterator, list); // $ExpectType number + fp.findIndex(valueIterator)(list); // $ExpectType number fp.findIndex("", list); // $ExpectType number fp.findIndex({ a: 42 }, list); // $ExpectType number - fp.findIndexFrom(predicateFn2, 1, list); // $ExpectType number - fp.findIndexFrom(predicateFn2)(1)(list); // $ExpectType number + fp.findIndexFrom(valueIterator, 1, list); // $ExpectType number + fp.findIndexFrom(valueIterator)(1)(list); // $ExpectType number fp.findIndexFrom("", 1, list); // $ExpectType number fp.findIndexFrom({ a: 42 }, 1, list); // $ExpectType number _.findLastIndex(list); // $ExpectType number - _.findLastIndex(list, predicateFn); // $ExpectType number + _.findLastIndex(list, listIterator); // $ExpectType number _.findLastIndex(list, ""); // $ExpectType number _.findLastIndex(list, {a: 42}); // $ExpectType number - _.findLastIndex(list, predicateFn, 1); // $ExpectType number + _.findLastIndex(list, listIterator, 1); // $ExpectType number _(list).findLastIndex(); // $ExpectType number - _(list).findLastIndex(predicateFn); // $ExpectType number + _(list).findLastIndex(listIterator); // $ExpectType number _(list).findLastIndex(""); // $ExpectType number _(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType number - _(list).findLastIndex(predicateFn, 1); // $ExpectType number + _(list).findLastIndex(listIterator, 1); // $ExpectType number _.chain(list).findLastIndex(); // $ExpectType LoDashExplicitWrapper - _.chain(list).findLastIndex(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).findLastIndex(""); // $ExpectType LoDashExplicitWrapper _.chain(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper - _.chain(list).findLastIndex(predicateFn, 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(listIterator, 1); // $ExpectType LoDashExplicitWrapper - fp.findLastIndex(predicateFn2, list); // $ExpectType number - fp.findLastIndex(predicateFn2)(list); // $ExpectType number + fp.findLastIndex(valueIterator, list); // $ExpectType number + fp.findLastIndex(valueIterator)(list); // $ExpectType number fp.findLastIndex("", list); // $ExpectType number fp.findLastIndex({ a: 42 }, list); // $ExpectType number - fp.findLastIndexFrom(predicateFn2, 1, list); // $ExpectType number - fp.findLastIndexFrom(predicateFn2)(1)(list); // $ExpectType number + fp.findLastIndexFrom(valueIterator, 1, list); // $ExpectType number + fp.findLastIndexFrom(valueIterator)(1)(list); // $ExpectType number fp.findLastIndexFrom("", 1, list); // $ExpectType number fp.findLastIndexFrom({ a: 42 }, 1, list); // $ExpectType number } // _.first { - const list: _.List | null | undefined = anything; - _.first("abc"); // $ExpectType string | undefined _.first(list); // $ExpectType AbcObject | undefined @@ -590,8 +522,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.head("abc"); // $ExpectType string | undefined _.head(list); // $ExpectType AbcObject | undefined @@ -610,46 +540,41 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const value: AbcObject = { a: 1, b: "", c: true }; + _.indexOf(list, abcObject); // $ExpectType number + _.indexOf(list, abcObject, 42); // $ExpectType number + _(list).indexOf(abcObject); // $ExpectType number + _(list).indexOf(abcObject, 42); // $ExpectType number + _.chain(list).indexOf(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(list).indexOf(abcObject, 42); // $ExpectType LoDashExplicitWrapper + fp.indexOf(abcObject, list); // $ExpectType number + fp.indexOf(abcObject)(list); // $ExpectType number + fp.indexOfFrom(abcObject)(42)(list); // $ExpectType number - _.indexOf(list, value); // $ExpectType number - _.indexOf(list, value, 42); // $ExpectType number - _(list).indexOf(value); // $ExpectType number - _(list).indexOf(value, 42); // $ExpectType number - _.chain(list).indexOf(value); // $ExpectType LoDashExplicitWrapper - _.chain(list).indexOf(value, 42); // $ExpectType LoDashExplicitWrapper - fp.indexOf(value, list); // $ExpectType number - fp.indexOf(value)(list); // $ExpectType number - fp.indexOfFrom(value)(42)(list); // $ExpectType number + _.lastIndexOf(list, abcObject); // $ExpectType number + _.lastIndexOf(list, abcObject, 42); // $ExpectType number + _(list).lastIndexOf(abcObject); // $ExpectType number + _(list).lastIndexOf(abcObject, 42); // $ExpectType number + _.chain(list).lastIndexOf(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(list).lastIndexOf(abcObject, 42); // $ExpectType LoDashExplicitWrapper + fp.lastIndexOf(abcObject, list); // $ExpectType number + fp.lastIndexOf(abcObject)(list); // $ExpectType number + fp.lastIndexOfFrom(abcObject)(42)(list); // $ExpectType number - _.lastIndexOf(list, value); // $ExpectType number - _.lastIndexOf(list, value, 42); // $ExpectType number - _(list).lastIndexOf(value); // $ExpectType number - _(list).lastIndexOf(value, 42); // $ExpectType number - _.chain(list).lastIndexOf(value); // $ExpectType LoDashExplicitWrapper - _.chain(list).lastIndexOf(value, 42); // $ExpectType LoDashExplicitWrapper - fp.lastIndexOf(value, list); // $ExpectType number - fp.lastIndexOf(value)(list); // $ExpectType number - fp.lastIndexOfFrom(value)(42)(list); // $ExpectType number + _.sortedIndexOf(list, abcObject); // $ExpectType number + _(list).sortedIndexOf(abcObject); // $ExpectType number + _.chain(list).indexOf(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedIndexOf(abcObject, list); // $ExpectType number + fp.sortedIndexOf(abcObject)(list); // $ExpectType number - _.sortedIndexOf(list, value); // $ExpectType number - _(list).sortedIndexOf(value); // $ExpectType number - _.chain(list).indexOf(value); // $ExpectType LoDashExplicitWrapper - fp.sortedIndexOf(value, list); // $ExpectType number - fp.sortedIndexOf(value)(list); // $ExpectType number - - _.sortedLastIndexOf(list, value); // $ExpectType number - _(list).sortedLastIndexOf(value); // $ExpectType number - _.chain(list).sortedLastIndexOf(value); // $ExpectType LoDashExplicitWrapper - fp.sortedLastIndexOf(value, list); // $ExpectType number - fp.sortedLastIndexOf(value)(list); // $ExpectType number + _.sortedLastIndexOf(list, abcObject); // $ExpectType number + _(list).sortedLastIndexOf(abcObject); // $ExpectType number + _.chain(list).sortedLastIndexOf(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndexOf(abcObject, list); // $ExpectType number + fp.sortedLastIndexOf(abcObject)(list); // $ExpectType number } // _.initial { - const list: _.List | null | undefined = anything; - _.initial(list); // $ExpectType AbcObject[] _(list).initial(); // $ExpectType LoDashImplicitWrapper _.chain(list).initial(); // $ExpectType LoDashExplicitWrapper @@ -840,8 +765,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.last("abc"); // $ExpectType string | undefined _.last(list); // $ExpectType AbcObject | undefined @@ -857,8 +780,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.nth(list, 42); // $ExpectType AbcObject | undefined _(list).nth(42); // $ExpectType AbcObject | undefined _.chain(list).nth(42); // $ExpectType LoDashExplicitWrapper @@ -871,32 +792,30 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper = []; - const value: AbcObject = { a: 1, b: "", c: true }; _.pull(array); // $ExpectType AbcObject[] - _.pull(array, value); // $ExpectType AbcObject[] - _.pull(array, value, value, value); // $ExpectType AbcObject[] + _.pull(array, abcObject); // $ExpectType AbcObject[] + _.pull(array, abcObject, abcObject, abcObject); // $ExpectType AbcObject[] _.pull(list); // $ExpectType ArrayLike - _.pull(list, value); // $ExpectType ArrayLike - _.pull(list, value, value, value); // $ExpectType ArrayLike + _.pull(list, abcObject); // $ExpectType ArrayLike + _.pull(list, abcObject, abcObject, abcObject); // $ExpectType ArrayLike _(array).pull(); // $ExpectType LoDashImplicitWrapper - _(array).pull(value); // $ExpectType LoDashImplicitWrapper - _(array).pull(value, value, value); // $ExpectType LoDashImplicitWrapper + _(array).pull(abcObject); // $ExpectType LoDashImplicitWrapper + _(array).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashImplicitWrapper _(list).pull(); // $ExpectType LoDashImplicitWrapper> - _(list).pull(value); // $ExpectType LoDashImplicitWrapper> - _(list).pull(value, value, value); // $ExpectType LoDashImplicitWrapper> + _(list).pull(abcObject); // $ExpectType LoDashImplicitWrapper> + _(list).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashImplicitWrapper> _.chain(array).pull(); // $ExpectType LoDashExplicitWrapper - _.chain(array).pull(value); // $ExpectType LoDashExplicitWrapper - _.chain(array).pull(value, value, value); // $ExpectType LoDashExplicitWrapper + _.chain(array).pull(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(array).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashExplicitWrapper _.chain(list).pull(); // $ExpectType LoDashExplicitWrapper> - _.chain(list).pull(value); // $ExpectType LoDashExplicitWrapper> - _.chain(list).pull(value, value, value); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pull(abcObject); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashExplicitWrapper> - fp.pull(value, array); // $ExpectType AbcObject[] - fp.pull(value, list); // $ExpectType ArrayLike - fp.pull(value)(list); // $ExpectType ArrayLike + fp.pull(abcObject, array); // $ExpectType AbcObject[] + fp.pull(abcObject)(list); // $ExpectType ArrayLike } // _.pullAt @@ -1137,34 +1056,30 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper = []; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; _.remove(list); // $ExpectType AbcObject[] - _.remove(list, predicateFn); // $ExpectType AbcObject[] + _.remove(list, listIterator); // $ExpectType AbcObject[] _.remove(list, ""); // $ExpectType AbcObject[] _.remove(list, { a: 42 }); // $ExpectType AbcObject[] _(list).remove(); // $ExpectType LoDashImplicitWrapper - _(list).remove(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).remove(listIterator); // $ExpectType LoDashImplicitWrapper _(list).remove(""); // $ExpectType LoDashImplicitWrapper _(list).remove({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).remove(); // $ExpectType LoDashExplicitWrapper - _.chain(list).remove(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).remove(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).remove(""); // $ExpectType LoDashExplicitWrapper _.chain(list).remove({ a: 42 }); // $ExpectType LoDashExplicitWrapper - const predicateFn2 = (value: AbcObject) => true; - fp.remove(predicateFn2, list); // $ExpectType AbcObject[] - fp.remove(predicateFn2)(list); // $ExpectType AbcObject[] + fp.remove(valueIterator, list); // $ExpectType AbcObject[] + fp.remove(valueIterator)(list); // $ExpectType AbcObject[] fp.remove("", list); // $ExpectType AbcObject[] fp.remove({ a: 42 }, list); // $ExpectType AbcObject[] } // _.tail { - const list: _.List | null | undefined = anything; - _.tail(list); // $ExpectType AbcObject[] _(list).tail(); // $ExpectType LoDashImplicitWrapper _.chain(list).tail(); // $ExpectType LoDashExplicitWrapper @@ -1173,8 +1088,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const value: AbcObject = { a: 1, b: "", c: true }; - const listIterator = (value: AbcObject) => 0; + _.sortedIndexBy(list, abcObject, valueIterator); // $ExpectType number + _.sortedIndexBy(list, abcObject, ""); // $ExpectType number + _.sortedIndexBy(list, abcObject, { a: 42 }); // $ExpectType number + _(list).sortedIndexBy(abcObject, valueIterator); // $ExpectType number + _(list).sortedIndexBy(abcObject, ""); // $ExpectType number + _(list).sortedIndexBy(abcObject, { a: 42 }); // $ExpectType number + _.chain(list).sortedIndexBy(abcObject, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedIndexBy(abcObject, ""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedIndexBy(abcObject, { a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.sortedIndexBy(valueIterator, abcObject, list); // $ExpectType number + fp.sortedIndexBy(valueIterator)(abcObject)(list); // $ExpectType number + fp.sortedIndexBy("a", abcObject, list); // $ExpectType number + fp.sortedIndexBy({ a: 42 }, abcObject, list); // $ExpectType number - _.sortedIndexBy(list, value, listIterator); // $ExpectType number - _.sortedIndexBy(list, value, ""); // $ExpectType number - _.sortedIndexBy(list, value, { a: 42 }); // $ExpectType number - _(list).sortedIndexBy(value, listIterator); // $ExpectType number - _(list).sortedIndexBy(value, ""); // $ExpectType number - _(list).sortedIndexBy(value, { a: 42 }); // $ExpectType number - _.chain(list).sortedIndexBy(value, listIterator); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedIndexBy(value, ""); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedIndexBy(value, { a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.sortedIndexBy(listIterator, value, list); // $ExpectType number - fp.sortedIndexBy(listIterator)(value)(list); // $ExpectType number - fp.sortedIndexBy("a", value, list); // $ExpectType number - fp.sortedIndexBy({ a: 42 }, value, list); // $ExpectType number - - _.sortedLastIndexBy(list, value, listIterator); // $ExpectType number - _.sortedLastIndexBy(list, value, ""); // $ExpectType number - _.sortedLastIndexBy(list, value, { a: 42 }); // $ExpectType number - _(list).sortedLastIndexBy(value, listIterator); // $ExpectType number - _(list).sortedLastIndexBy(value, ""); // $ExpectType number - _(list).sortedLastIndexBy(value, { a: 42 }); // $ExpectType number - _.chain(list).sortedLastIndexBy(value, listIterator); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedLastIndexBy(value, ""); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedLastIndexBy(value, { a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.sortedLastIndexBy(listIterator, value, list); // $ExpectType number - fp.sortedLastIndexBy(listIterator)(value)(list); // $ExpectType number - fp.sortedLastIndexBy("a", value, list); // $ExpectType number - fp.sortedLastIndexBy({ a: 42 }, value, list); // $ExpectType number + _.sortedLastIndexBy(list, abcObject, valueIterator); // $ExpectType number + _.sortedLastIndexBy(list, abcObject, ""); // $ExpectType number + _.sortedLastIndexBy(list, abcObject, { a: 42 }); // $ExpectType number + _(list).sortedLastIndexBy(abcObject, valueIterator); // $ExpectType number + _(list).sortedLastIndexBy(abcObject, ""); // $ExpectType number + _(list).sortedLastIndexBy(abcObject, { a: 42 }); // $ExpectType number + _.chain(list).sortedLastIndexBy(abcObject, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedLastIndexBy(abcObject, ""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedLastIndexBy(abcObject, { a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndexBy(valueIterator, abcObject, list); // $ExpectType number + fp.sortedLastIndexBy(valueIterator)(abcObject)(list); // $ExpectType number + fp.sortedLastIndexBy("a", abcObject, list); // $ExpectType number + fp.sortedLastIndexBy({ a: 42 }, abcObject, list); // $ExpectType number } // _.sortedIndex // _.sortedLastIndex { - const list: _.List | null | undefined = anything; - const value: AbcObject = { a: 1, b: "", c: true }; + _.sortedIndex(list, abcObject); // $ExpectType number + _(list).sortedIndex(abcObject); // $ExpectType number + _.chain(list).sortedIndex(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedIndex(abcObject, list); // $ExpectType number + fp.sortedIndex(abcObject)(list); // $ExpectType number - _.sortedIndex(list, value); // $ExpectType number - _(list).sortedIndex(value); // $ExpectType number - _.chain(list).sortedIndex(value); // $ExpectType LoDashExplicitWrapper - fp.sortedIndex(value, list); // $ExpectType number - fp.sortedIndex(value)(list); // $ExpectType number - - _.sortedLastIndex(list, value); // $ExpectType number - _(list).sortedLastIndex(value); // $ExpectType number - _.chain(list).sortedLastIndex(value); // $ExpectType LoDashExplicitWrapper - fp.sortedLastIndex(value, list); // $ExpectType number - fp.sortedLastIndex(value)(list); // $ExpectType number + _.sortedLastIndex(list, abcObject); // $ExpectType number + _(list).sortedLastIndex(abcObject); // $ExpectType number + _.chain(list).sortedLastIndex(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndex(abcObject, list); // $ExpectType number + fp.sortedLastIndex(abcObject)(list); // $ExpectType number } // _.take // _.takeRight { - const list: _.List | null | undefined = anything; - _.take(list); // $ExpectType AbcObject[] _.take(list, 42); // $ExpectType AbcObject[] _(list).take(); // $ExpectType LoDashImplicitWrapper @@ -1269,55 +1173,49 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - const predicateFn2 = (value: AbcObject) => true; - _.takeWhile(list); // $ExpectType AbcObject[] - _.takeWhile(list, predicateFn); // $ExpectType AbcObject[] + _.takeWhile(list, listIterator); // $ExpectType AbcObject[] _.takeWhile(list, ""); // $ExpectType AbcObject[] _.takeWhile(list, { a: 42 }); // $ExpectType AbcObject[] _(list).takeWhile(); // $ExpectType LoDashImplicitWrapper - _(list).takeWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).takeWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).takeWhile(""); // $ExpectType LoDashImplicitWrapper _(list).takeWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).takeWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).takeWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).takeWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).takeWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.takeWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.takeWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.takeWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.takeWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.takeWhile("a", list); // $ExpectType AbcObject[] fp.takeWhile({ a: 42 }, list); // $ExpectType AbcObject[] _.takeRightWhile(list); // $ExpectType AbcObject[] - _.takeRightWhile(list, predicateFn); // $ExpectType AbcObject[] + _.takeRightWhile(list, listIterator); // $ExpectType AbcObject[] _.takeRightWhile(list, ""); // $ExpectType AbcObject[] _.takeRightWhile(list, { a: 42 }); // $ExpectType AbcObject[] _(list).takeRightWhile(); // $ExpectType LoDashImplicitWrapper - _(list).takeRightWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).takeRightWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).takeRightWhile(""); // $ExpectType LoDashImplicitWrapper _(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).takeRightWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).takeRightWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeRightWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).takeRightWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.takeRightWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.takeRightWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.takeRightWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.takeRightWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.takeRightWhile("a", list); // $ExpectType AbcObject[] fp.takeRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.union { - const list: _.List | null | undefined = anything; - _.union(list); // $ExpectType AbcObject[] _.union(list, list); // $ExpectType AbcObject[] _.union(list, list, list); // $ExpectType AbcObject[] @@ -1336,13 +1234,9 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const iteratee = (value: AbcObject) => 1; - _.unionBy(list, list); // $ExpectType AbcObject[] - _.unionBy(list, list, list, list, list, list); // $ExpectType AbcObject[] - _.unionBy(list, list, iteratee); // $ExpectType AbcObject[] - _.unionBy(list, list, list, list, list, list, iteratee); // $ExpectType AbcObject[] + _.unionBy(list, list, valueIterator); // $ExpectType AbcObject[] + _.unionBy(list, list, list, list, list, list, valueIterator); // $ExpectType AbcObject[] _.unionBy(list, list, "a"); // $ExpectType AbcObject[] // param needed for TS 2.3 _.unionBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] @@ -1350,9 +1244,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _(list).unionBy(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper - _(list).unionBy(list, iteratee); // $ExpectType LoDashImplicitWrapper - _(list).unionBy(list, list, list, list, list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, valueIterator); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashImplicitWrapper _(list).unionBy(list, "a"); // $ExpectType LoDashImplicitWrapper // param needed for TS 2.3 _(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper @@ -1360,17 +1253,16 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list); // $ExpectType LoDashExplicitWrapper - _.chain(list).unionBy(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper - _.chain(list).unionBy(list, iteratee); // $ExpectType LoDashExplicitWrapper - _.chain(list).unionBy(list, list, list, list, list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, "a"); // $ExpectType LoDashExplicitWrapper // param needed for TS 2.3 _.chain(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper - fp.unionBy(iteratee, list, list); // $ExpectType AbcObject[] - fp.unionBy(iteratee)(list)(list); // $ExpectType AbcObject[] + fp.unionBy(valueIterator, list, list); // $ExpectType AbcObject[] + fp.unionBy(valueIterator)(list)(list); // $ExpectType AbcObject[] fp.unionBy("a", list, list); // $ExpectType AbcObject[] fp.unionBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } @@ -1378,8 +1270,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.uniq("abc"); // $ExpectType string[] _.uniq(list); // $ExpectType AbcObject[] _(list).uniq(); // $ExpectType LoDashImplicitWrapper @@ -1398,10 +1288,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const stringIterator = (value: string) => ""; - const valueIterator = (value: AbcObject) => 0; - _.uniqBy("abc", stringIterator); // $ExpectType string[] _.uniqBy(list, valueIterator); // $ExpectType AbcObject[] _.uniqBy(list, "a"); // $ExpectType AbcObject[] @@ -1495,8 +1381,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.xor(list); // $ExpectType AbcObject[] _.xor(list, list); // $ExpectType AbcObject[] _.xor(list, list, list); // $ExpectType AbcObject[] @@ -1515,13 +1399,9 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const iteratee = (value: AbcObject) => 1; - _.xorBy(list, list); // $ExpectType AbcObject[] - _.xorBy(list, list, list, list, list, list); // $ExpectType AbcObject[] - _.xorBy(list, list, iteratee); // $ExpectType AbcObject[] - _.xorBy(list, list, list, list, list, list, iteratee); // $ExpectType AbcObject[] + _.xorBy(list, list, valueIterator); // $ExpectType AbcObject[] + _.xorBy(list, list, list, list, list, list, valueIterator); // $ExpectType AbcObject[] _.xorBy(list, list, "a"); // $ExpectType AbcObject[] // param needed for TS 2.3 _.xorBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] @@ -1529,9 +1409,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _(list).xorBy(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper - _(list).xorBy(list, iteratee); // $ExpectType LoDashImplicitWrapper - _(list).xorBy(list, list, list, list, list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, valueIterator); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashImplicitWrapper _(list).xorBy(list, "a"); // $ExpectType LoDashImplicitWrapper // param needed for TS 2.3 _(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper @@ -1539,25 +1418,22 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list); // $ExpectType LoDashExplicitWrapper - _.chain(list).xorBy(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper - _.chain(list).xorBy(list, iteratee); // $ExpectType LoDashExplicitWrapper - _.chain(list).xorBy(list, list, list, list, list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, "a"); // $ExpectType LoDashExplicitWrapper // param needed for TS 2.3 _.chain(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper - fp.xorBy(iteratee, list, list); // $ExpectType AbcObject[] - fp.xorBy(iteratee)(list)(list); // $ExpectType AbcObject[] + fp.xorBy(valueIterator, list, list); // $ExpectType AbcObject[] + fp.xorBy(valueIterator)(list)(list); // $ExpectType AbcObject[] fp.xorBy("a", list, list); // $ExpectType AbcObject[] fp.xorBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } // _.zip { - const list: _.List | null | undefined = anything; - _.zip(list); // $ExpectType (AbcObject | undefined)[][] _.zip(list, list); // $ExpectType (AbcObject | undefined)[][] _.zip(list, list, list, list, list, list); // $ExpectType (AbcObject | undefined)[][] @@ -1691,9 +1567,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; const abcObject: AbcObject | null | undefined = anything; _.at(list, 0, "1", [2], ["3"], [4, "5"]); // $ExpectType AbcObject[] @@ -1719,13 +1592,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const stringIterator = (value: string) => 1; - const valueIterator = (value: AbcObject) => 1; - _.countBy(""); // $ExpectType Dictionary _.countBy("", stringIterator); // $ExpectType Dictionary @@ -1793,15 +1659,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; - const valueIterator = (value: AbcObject) => true; - _.every(list); // $ExpectType boolean _.every(list, listIterator); // $ExpectType boolean _.every(list, "a"); // $ExpectType boolean @@ -1874,13 +1731,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const stringIterator = (char: string, index: number, string: string) => true; - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const valueIterator = (value: AbcObject) => true; _.filter("", stringIterator); // $ExpectType string[] _.filter(list, listIterator); // $ExpectType AbcObject[] @@ -1942,13 +1793,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const valueIterator = (value: AbcObject) => true; - _.find(list); // $ExpectType AbcObject | undefined _.find(list, listIterator); // $ExpectType AbcObject | undefined _.find(list, listIterator, 1); // $ExpectType AbcObject | undefined @@ -2138,7 +1982,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; @@ -2206,22 +2050,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; - const numDictionary: _.Dictionary | null | undefined = anything; - const objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - const numNumericDictionary: _.NumericDictionary | null | undefined = anything; - const objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - - const stringIterator = (value: string, index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | string => ""; - const listIterator = (value: number | number[], index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | number => 1; - const dictionaryIterator = (value: number | number[], key: string, collection: _.Dictionary): _.ListOfRecursiveArraysOrValues | number => 1; - const numericDictionaryIterator = (value: number | number[], key: string, collection: _.NumericDictionary): _.ListOfRecursiveArraysOrValues | number => 1; - const valueIterator = (value: number | number[]): _.ListOfRecursiveArraysOrValues | number => 1; _.flatMapDepth("abc"); // $ExpectType string[] _.flatMapDepth("abc", stringIterator); // $ExpectType string[] @@ -2289,7 +2117,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; const nilDictionary: _.Dictionary | null | undefined = anything; const nilNumericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; const nilAbcObject: AbcObject | null | undefined = anything; // $ExpectType string @@ -2516,16 +2343,14 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - const stringIterator2 = (char: string) => 1; - const listIterator2 = (value: AbcObject) => 1; - fp.forEach(stringIterator2, ""); // $ExpectType string - fp.forEach(listIterator2, array); // $ExpectType AbcObject[] - fp.forEach(listIterator2)(array); // $ExpectType AbcObject[] - fp.forEach(listIterator2, list); // $ExpectType ArrayLike - fp.forEach(listIterator2, dictionary); // $ExpectType Dictionary - fp.forEach(listIterator2, nilArray); // $ExpectType AbcObject[] | null | undefined - fp.forEach(listIterator2, nilList); // $ExpectType ArrayLike | null | undefined - fp.forEach(listIterator2, nilDictionary); // $ExpectType Dictionary | null | undefined + fp.forEach(stringIterator, ""); // $ExpectType string + fp.forEach(valueIterator, array); // $ExpectType AbcObject[] + fp.forEach(valueIterator)(array); // $ExpectType AbcObject[] + fp.forEach(valueIterator, list); // $ExpectType ArrayLike + fp.forEach(valueIterator, dictionary); // $ExpectType Dictionary + fp.forEach(valueIterator, nilArray); // $ExpectType AbcObject[] | null | undefined + fp.forEach(valueIterator, nilList); // $ExpectType ArrayLike | null | undefined + fp.forEach(valueIterator, nilDictionary); // $ExpectType Dictionary | null | undefined // $ExpectType AbcObject[] _.forEachRight(array, (value, index, collection) => { @@ -2563,8 +2388,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - fp.forEachRight(listIterator2, array); // $ExpectType AbcObject[] - fp.forEachRight(listIterator2)(array); // $ExpectType AbcObject[] + fp.forEachRight(valueIterator, array); // $ExpectType AbcObject[] + fp.forEachRight(valueIterator)(array); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.each(array, (value, index, collection) => { @@ -2602,8 +2427,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - fp.each(listIterator2, array); // $ExpectType AbcObject[] - fp.each(listIterator2)(array); // $ExpectType AbcObject[] + fp.each(valueIterator, array); // $ExpectType AbcObject[] + fp.each(valueIterator)(array); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.eachRight(array, (value, index, collection) => { @@ -2641,18 +2466,12 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - fp.eachRight(listIterator2, array); // $ExpectType AbcObject[] - fp.eachRight(listIterator2)(array); // $ExpectType AbcObject[] + fp.eachRight(valueIterator, array); // $ExpectType AbcObject[] + fp.eachRight(valueIterator)(array); // $ExpectType AbcObject[] } // _.groupBy { - const list: _.List | null | undefined = [] as any; - const dictionary: _.Dictionary | null | undefined = anything; - - const stringIterator = (char: string) => 0; - const valueIterator = (value: AbcObject) => 0; - _.groupBy(""); // $ExpectType Dictionary _.groupBy("", stringIterator); // $ExpectType Dictionary _.groupBy(list); // $ExpectType Dictionary @@ -2699,42 +2518,33 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const target: AbcObject = { a: 42, b: "", c: true }; + _.includes(list, abcObject); // $ExpectType boolean + _.includes(list, abcObject, 42); // $ExpectType boolean + _.includes(dictionary, abcObject); // $ExpectType boolean + _.includes(dictionary, abcObject, 42); // $ExpectType boolean - _.includes(list, target); // $ExpectType boolean - _.includes(list, target, 42); // $ExpectType boolean - _.includes(dictionary, target); // $ExpectType boolean - _.includes(dictionary, target, 42); // $ExpectType boolean + _(list).includes(abcObject); // $ExpectType boolean + _(list).includes(abcObject, 42); // $ExpectType boolean + _(dictionary).includes(abcObject); // $ExpectType boolean + _(dictionary).includes(abcObject, 42); // $ExpectType boolean - _(list).includes(target); // $ExpectType boolean - _(list).includes(target, 42); // $ExpectType boolean - _(dictionary).includes(target); // $ExpectType boolean - _(dictionary).includes(target, 42); // $ExpectType boolean + _.chain(list).includes(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(list).includes(abcObject, 42); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).includes(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).includes(abcObject, 42); // $ExpectType LoDashExplicitWrapper - _.chain(list).includes(target); // $ExpectType LoDashExplicitWrapper - _.chain(list).includes(target, 42); // $ExpectType LoDashExplicitWrapper - _.chain(dictionary).includes(target); // $ExpectType LoDashExplicitWrapper - _.chain(dictionary).includes(target, 42); // $ExpectType LoDashExplicitWrapper + fp.includes(abcObject, list); // $ExpectType boolean + fp.includes(abcObject)(list); // $ExpectType boolean + fp.includes(abcObject, dictionary); // $ExpectType boolean - fp.includes(target, list); // $ExpectType boolean - fp.includes(target)(list); // $ExpectType boolean - fp.includes(target, dictionary); // $ExpectType boolean - - fp.includesFrom(target, 42, list); // $ExpectType boolean - fp.includesFrom(target)(42)(list); // $ExpectType boolean - fp.includesFrom(target, 42, dictionary); // $ExpectType boolean + fp.includesFrom(abcObject, 42, list); // $ExpectType boolean + fp.includesFrom(abcObject)(42)(list); // $ExpectType boolean + fp.includesFrom(abcObject, 42, dictionary); // $ExpectType boolean } // _.keyBy { - const list: _.List | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const stringIterator = (value: string) => "a"; - const valueIterator = (value: AbcObject) => 1; + const valueIterator = (value: AbcObject) => ""; _.keyBy("abcd"); // $ExpectType Dictionary _.keyBy("abcd", stringIterator); // $ExpectType Dictionary @@ -2878,11 +2688,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; - _.map(list); // $ExpectType AbcObject[] // $ExpectType number[] _.map(list, (value, index, collection) => { @@ -2995,8 +2800,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - // $ExpectType [any[], any[]] _.partition(anything, (value) => { value; // $ExpectType any @@ -3110,13 +2913,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const stringIterator = (char: string, index: number, string: string) => true; - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const valueIterator = (value: AbcObject) => true; _.reject("", stringIterator); // $ExpectType string[] _.reject(list, listIterator); // $ExpectType AbcObject[] @@ -3207,9 +3004,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - _.shuffle("abc"); // $ExpectType string[] _.shuffle(list); // $ExpectType AbcObject[] _.shuffle(dictionary); // $ExpectType AbcObject[] @@ -3226,9 +3020,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - _.size(list); // $ExpectType number _.size(dictionary); // $ExpectType number _.size(""); // $ExpectType number @@ -3245,15 +3036,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; - const valueIterator = (value: AbcObject) => true; - _.some(list); // $ExpectType boolean _.some(list, listIterator); // $ExpectType boolean _.some(list, "a"); // $ExpectType boolean @@ -3326,13 +3108,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => 0; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => 0; - const valueIterator = (value: AbcObject) => 0; - _.sortBy(list); // $ExpectType AbcObject[] _.sortBy(list, listIterator); // $ExpectType AbcObject[] _.sortBy(list, listIterator, listIterator); // $ExpectType AbcObject[] @@ -3380,10 +3155,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - _.orderBy("acbd", (value) => 1); // $ExpectType string[] _.orderBy("acbd", (value) => 1, true); // $ExpectType string[] _.orderBy("acbd", [(value) => 1, (value) => 2], [true, false]); // $ExpectType string[] @@ -4882,8 +4653,6 @@ fp.now(); // $ExpectType number { const list: ArrayLike = anything; - const valueIterator = (value: AbcObject) => 0; - _.maxBy(list, valueIterator); // $ExpectType AbcObject | undefined _.maxBy(list, "a"); // $ExpectType AbcObject | undefined _.maxBy(list, { a: 42 }); // $ExpectType AbcObject | undefined @@ -4976,7 +4745,6 @@ fp.now(); // $ExpectType number // _.sumBy { - const list: ArrayLike | null | undefined = anything; const listIterator = (value: AbcObject) => 0; _.sumBy(list, listIterator); // $ExpectType number @@ -5235,7 +5003,6 @@ fp.now(); // $ExpectType number { const dictionary: _.Dictionary = anything; const numericDictionary: _.NumericDictionary = anything; - const abcObject: AbcObject = anything; _.entries(dictionary); // $ExpectType [string, number][] _.entries(numericDictionary); // $ExpectType [string, number][] @@ -5362,17 +5129,15 @@ fp.now(); // $ExpectType number // _.functions // _.functionsIn { - const object: AbcObject = anything; + _.functions(abcObject); // $ExpectType string[] + _(abcObject).functions(); // $ExpectType LoDashImplicitWrapper + _.chain(abcObject).functions(); // $ExpectType LoDashExplicitWrapper + fp.functions(abcObject); // $ExpectType string[] - _.functions(object); // $ExpectType string[] - _(object).functions(); // $ExpectType LoDashImplicitWrapper - _.chain(object).functions(); // $ExpectType LoDashExplicitWrapper - fp.functions(object); // $ExpectType string[] - - _.functionsIn(object); // $ExpectType string[] - _(object).functionsIn(); // $ExpectType LoDashImplicitWrapper - _.chain(object).functionsIn(); // $ExpectType LoDashExplicitWrapper - fp.functionsIn(object); // $ExpectType string[] + _.functionsIn(abcObject); // $ExpectType string[] + _(abcObject).functionsIn(); // $ExpectType LoDashImplicitWrapper + _.chain(abcObject).functionsIn(); // $ExpectType LoDashExplicitWrapper + fp.functionsIn(abcObject); // $ExpectType string[] } // _.get @@ -5396,7 +5161,7 @@ fp.now(); // $ExpectType number _.chain("abc").get(1); // $ExpectType LoDashExplicitWrapper _.chain("abc").get(["0"], "_"); - _.chain([42]).get(0, -1); // $ExpectType LoDashExplicitWrapper + _.chain([42]).get(0, -1); // ExpectType LoDashExplicitWrapper _.chain({ a: { b: true } }).get("a"); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a"]); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a", "b"]); // $ExpectType LoDashExplicitWrapper @@ -5419,33 +5184,31 @@ fp.now(); // $ExpectType number // _.has // _.hasIn { - const object: AbcObject = anything; + _.has(abcObject, ""); // $ExpectType boolean + _.has(abcObject, 42); // $ExpectType boolean + _.has(abcObject, ["", 42]); // $ExpectType boolean + _(abcObject).has(""); // $ExpectType boolean + _(abcObject).has(42); // $ExpectType boolean + _(abcObject).has(["", 42]); // $ExpectType boolean + _.chain(abcObject).has(""); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).has(42); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).has(["", 42]); // $ExpectType LoDashExplicitWrapper + fp.has("a", abcObject); // $ExpectType boolean + fp.has("a")(abcObject); // $ExpectType boolean + fp.has(["a", 42])(abcObject); // $ExpectType boolean - _.has(object, ""); // $ExpectType boolean - _.has(object, 42); // $ExpectType boolean - _.has(object, ["", 42]); // $ExpectType boolean - _(object).has(""); // $ExpectType boolean - _(object).has(42); // $ExpectType boolean - _(object).has(["", 42]); // $ExpectType boolean - _.chain(object).has(""); // $ExpectType LoDashExplicitWrapper - _.chain(object).has(42); // $ExpectType LoDashExplicitWrapper - _.chain(object).has(["", 42]); // $ExpectType LoDashExplicitWrapper - fp.has("a", object); // $ExpectType boolean - fp.has("a")(object); // $ExpectType boolean - fp.has(["a", 42])(object); // $ExpectType boolean - - _.hasIn(object, ""); // $ExpectType boolean - _.hasIn(object, 42); // $ExpectType boolean - _.hasIn(object, ["", 42]); // $ExpectType boolean - _(object).hasIn(""); // $ExpectType boolean - _(object).hasIn(42); // $ExpectType boolean - _(object).hasIn(["", 42]); // $ExpectType boolean - _.chain(object).hasIn(""); // $ExpectType LoDashExplicitWrapper - _.chain(object).hasIn(42); // $ExpectType LoDashExplicitWrapper - _.chain(object).hasIn(["", 42]); // $ExpectType LoDashExplicitWrapper - fp.hasIn("a", object); // $ExpectType boolean - fp.hasIn("a")(object); // $ExpectType boolean - fp.hasIn(["a", 42])(object); // $ExpectType boolean + _.hasIn(abcObject, ""); // $ExpectType boolean + _.hasIn(abcObject, 42); // $ExpectType boolean + _.hasIn(abcObject, ["", 42]); // $ExpectType boolean + _(abcObject).hasIn(""); // $ExpectType boolean + _(abcObject).hasIn(42); // $ExpectType boolean + _(abcObject).hasIn(["", 42]); // $ExpectType boolean + _.chain(abcObject).hasIn(""); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).hasIn(42); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).hasIn(["", 42]); // $ExpectType LoDashExplicitWrapper + fp.hasIn("a", abcObject); // $ExpectType boolean + fp.hasIn("a")(abcObject); // $ExpectType boolean + fp.hasIn(["a", 42])(abcObject); // $ExpectType boolean } // _.invert @@ -5462,7 +5225,6 @@ fp.now(); // $ExpectType number const dictionary: _.Dictionary<{ a: number }> = {}; const numericDictionary: _.NumericDictionary<{ a: number }> = {}; - const stringIterator = (value: string) => 1; const valueIterator = (value: {a: number }) => 1; _.invertBy("foo"); // $ExpectType Dictionary @@ -5523,14 +5285,6 @@ fp.now(); // $ExpectType number // _.mapKeys { - const list: _.List| null | undefined = [] as any; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => ""; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => ""; - const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => ""; const abcObjectIterator = (value: AbcObject[keyof AbcObject], key: string, collection: AbcObject) => ""; _.mapKeys(list); // $ExpectType Dictionary @@ -5605,9 +5359,6 @@ fp.now(); // $ExpectType number // _.mapValues { - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; const abcObjectOrNull: AbcObject | null = anything; const key: string = anything; @@ -5774,10 +5525,9 @@ fp.now(); // $ExpectType number _.chain(abcObject).mapValues(); // $ExpectType LoDashExplicitWrapper _.chain(abcObjectOrNull).mapValues(); // $ExpectType LoDashExplicitWrapper> - const valueIterator = (value: AbcObject) => ""; - fp.mapValues(valueIterator)(dictionary); // $ExpectType Dictionary + fp.mapValues(valueIterator)(dictionary); // $ExpectType Dictionary fp.mapValues("a", dictionary); // $ExpectType Dictionary - fp.mapValues(valueIterator)(numericDictionary); // $ExpectType Dictionary + fp.mapValues(valueIterator)(numericDictionary); // $ExpectType Dictionary fp.mapValues({ a: 42 })(numericDictionary); // $ExpectType Dictionary fp.mapValues(value => "", abcObjectOrNull); // $ExpectType { a: string; b: string; c: string; } } @@ -5788,24 +5538,24 @@ fp.now(); // $ExpectType number const dictionary: _.Dictionary = anything; const numericDictionary: _.NumericDictionary = anything; - _.omit(obj, "a"); // $ExpectType Partial + _.omit(obj, "a"); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.4 _.omit(obj, ["b", 1], 0, "a"); // $ExpectType Partial _.omit(dictionary, "a"); // $ExpectType Dictionary _.omit(numericDictionary, "a"); // $ExpectType NumericDictionary - _(obj).omit("a"); // $ExpectType LoDashImplicitWrapper> + _(obj).omit("a"); // ExpectType LoDashImplicitWrapper> // NOTE: ExpectType disabled because it fails in TS2.4 _(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashImplicitWrapper> _(dictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> - _.chain(obj).omit("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(obj).omit("a"); // ExpectType LoDashExplicitWrapper> // NOTE: ExpectType disabled because it fails in TS2.4 _.chain(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> - fp.omit("a", obj); // $ExpectType Partial - fp.omit("a")(obj); // $ExpectType Partial - fp.omit(["a", "b"])(obj); // $ExpectType Partial + fp.omit("a", obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.4 + fp.omit("a")(obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.3 + fp.omit(["a", "b"])(obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.3 } // _.omitBy @@ -5825,7 +5575,7 @@ fp.now(); // $ExpectType number const obj1: AbcObject | null | undefined = anything; const obj2: AbcObject = anything; const readonlyArray: string[] = ["a", "b"]; // TODO: Should be ReadonlyArray, but see comment on type Many - const literalsArray = ["a" as "a", "b" as "b"]; + const literalsArray: Array<"a" | "b"> = ["a", "b"]; const roLiteralsArray: Array<"a" | "b"> = literalsArray; // TODO: Should be ReadonlyArray, but see comment on type Many _.pick(obj1, "a"); // $ExpectType PartialDeep @@ -5857,7 +5607,7 @@ fp.now(); // $ExpectType number fp.pick("a", obj2); // $ExpectType Pick fp.pick("a")(obj2); // $ExpectType Pick - fp.pick(["a" as "a", "b" as "b"])(obj2); // $ExpectType Pick + fp.pick(literalsArray)(obj2); // $ExpectType Pick } // _.pickBy @@ -5953,7 +5703,6 @@ fp.now(); // $ExpectType number { const dictionary: _.Dictionary = {}; const numericDictionary: _.NumericDictionary = {}; - const abcObject: AbcObject = anything; _.toPairs(dictionary); // $ExpectType [string, number][] _.toPairs(numericDictionary); // $ExpectType [string, number][] @@ -6060,9 +5809,10 @@ fp.now(); // $ExpectType number _(object).unset(["a", "b"]); // $ExpectType LoDashImplicitWrapper _.chain(object).unset("a.b"); // $ExpectType LoDashExplicitWrapper _.chain(object).unset(["a", "b"]); // $ExpectType LoDashExplicitWrapper - fp.unset("a.b", object); // $ExpectType boolean - fp.unset("a.b")(object); // $ExpectType boolean - fp.unset(["a", "b"])(object); // $ExpectType boolean + + fp.unset("a.b", object); // $ExpectType { a: { b: string; c: boolean; }; } + fp.unset("a.b")(object); // $ExpectType { a: { b: string; c: boolean; }; } + fp.unset(["a", "b"])(object); // $ExpectType { a: { b: string; c: boolean; }; } } // _.update @@ -6107,8 +5857,6 @@ fp.now(); // $ExpectType number { const dict: _.Dictionary = {}; const numDict: _.NumericDictionary = {}; - const list: _.List | null | undefined = anything; - const object: AbcObject = anything; _.values(123); // $ExpectType any[] _.values(true); // $ExpectType any[] @@ -6118,7 +5866,7 @@ fp.now(); // $ExpectType number _.values(dict); // $ExpectType AbcObject[] _.values(numDict); // $ExpectType AbcObject[] _.values(list); // $ExpectType AbcObject[] - _.values(object); // $ExpectType (string | number | boolean)[] + _.values(abcObject); // $ExpectType (string | number | boolean)[] _(true).values(); // $ExpectType LoDashImplicitWrapper _("hi").values(); // $ExpectType LoDashImplicitWrapper @@ -6134,13 +5882,13 @@ fp.now(); // $ExpectType number fp.values(dict); // $ExpectType AbcObject[] fp.values(numDict); // $ExpectType AbcObject[] fp.values(list); // $ExpectType AbcObject[] - fp.values(object); // $ExpectType (string | number | boolean)[] + fp.values(abcObject); // $ExpectType (string | number | boolean)[] _.valuesIn([true, false]); // $ExpectType boolean[] _.valuesIn(dict); // $ExpectType AbcObject[] _.valuesIn(numDict); // $ExpectType AbcObject[] _.valuesIn(list); // $ExpectType AbcObject[] - _.valuesIn(object); // $ExpectType (string | number | boolean)[] + _.valuesIn(abcObject); // $ExpectType (string | number | boolean)[] _(dict).valuesIn(); // $ExpectType LoDashImplicitWrapper _.chain(dict).valuesIn(); // $ExpectType LoDashExplicitWrapper @@ -6148,7 +5896,7 @@ fp.now(); // $ExpectType number fp.valuesIn(dict); // $ExpectType AbcObject[] fp.valuesIn(numDict); // $ExpectType AbcObject[] fp.valuesIn(list); // $ExpectType AbcObject[] - fp.valuesIn(object); // $ExpectType (string | number | boolean)[] + fp.valuesIn(abcObject); // $ExpectType (string | number | boolean)[] } /******* @@ -6162,16 +5910,7 @@ fp.now(); // $ExpectType number _(true); // $ExpectType LoDashImplicitWrapper _([""]); // $ExpectType LoDashImplicitWrapper _({ a: "" }); // $ExpectType LoDashImplicitWrapper<{ a: string; }> - - { - const a: AbcObject[] = []; - _(a); // $ExpectType LoDashImplicitWrapper - } - - { - const a: AbcObject[] | null | undefined = anything; - _(a); // $ExpectType LoDashImplicitWrapper - } + _(array); // $ExpectType LoDashImplicitWrapper } // _.chain @@ -6318,7 +6057,6 @@ fp.now(); // $ExpectType number _.chain(numberROA).concat(numberROA); // $ExpectType LoDashExplicitWrapper _.chain(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashExplicitWrapper - const abcObject: AbcObject = { a: 1, b: 'foo', c: true }; const objectROA: AbcObject[] = [{ a: 1, b: 'foo', c: true }]; // TODO: Should be ReadonlyArray, but see comment on type Many _.concat(abcObject, abcObject); // $ExpectType AbcObject[] @@ -6888,28 +6626,25 @@ fp.now(); // $ExpectType number // _.matches { - const source: AbcObject = { a: 1, b: "", c: true }; + _.matches(abcObject); // $ExpectType (value: any) => boolean + _.matches(abcObject); // $ExpectType (value: AbcObject) => boolean + _(abcObject).matches(); // $ExpectType LoDashImplicitWrapper<(value: AbcObject) => boolean> + _.chain(abcObject).matches(); // $ExpectType LoDashExplicitWrapper<(value: AbcObject) => boolean> - _.matches(source); // $ExpectType (value: any) => boolean - _.matches(source); // $ExpectType (value: AbcObject) => boolean - _(source).matches(); // $ExpectType LoDashImplicitWrapper<(value: AbcObject) => boolean> - _.chain(source).matches(); // $ExpectType LoDashExplicitWrapper<(value: AbcObject) => boolean> - - fp.matches(source, {}); // $ExpectType boolean - fp.matches(source)({}); // $ExpectType boolean + fp.matches(abcObject, {}); // $ExpectType boolean + fp.matches(abcObject)({}); // $ExpectType boolean } // _.matchesProperty { const path: string | string[] = anything; - const source: AbcObject = { a: 1, b: "", c: true }; - _.matchesProperty(path, source); // $ExpectType (value: any) => boolean - _.matchesProperty(path, source); // $ExpectType (value: AbcObject) => boolean - _(path).matchesProperty(source); // $ExpectType LoDashImplicitWrapper<(value: any) => boolean> - _(path).matchesProperty(source); - _.chain(path).matchesProperty(source); // $ExpectType LoDashExplicitWrapper<(value: any) => boolean> - fp.matchesProperty(path, source); // $ExpectType (value: any) => boolean + _.matchesProperty(path, abcObject); // $ExpectType (value: any) => boolean + _.matchesProperty(path, abcObject); // $ExpectType (value: AbcObject) => boolean + _(path).matchesProperty(abcObject); // $ExpectType LoDashImplicitWrapper<(value: any) => boolean> + _(path).matchesProperty(abcObject); + _.chain(path).matchesProperty(abcObject); // $ExpectType LoDashExplicitWrapper<(value: any) => boolean> + fp.matchesProperty(path, abcObject); // $ExpectType (value: any) => boolean } // _.method @@ -6936,15 +6671,13 @@ fp.now(); // $ExpectType number // _.methodOf { - const object: AbcObject = anything; - - _.methodOf(object); // $ExpectType (path: Many) => any - _.methodOf(object, anything, anything, anything); // $ExpectType (path: Many) => any - _(object).methodOf(); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> - _(object).methodOf(anything, anything, anything); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> - _.chain(object).methodOf(); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> - _.chain(object).methodOf(anything, anything, anything); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> - fp.methodOf(object); // $ExpectType (path: Many) => any + _.methodOf(abcObject) as (path: _.Many<_.PropertyName>) => any; + _.methodOf(abcObject, anything, anything, anything) as (path: _.Many<_.PropertyName>) => any; + _(abcObject).methodOf() as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _(abcObject).methodOf(anything, anything, anything) as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _.chain(abcObject).methodOf() as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _.chain(abcObject).methodOf(anything, anything, anything) as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + fp.methodOf(abcObject) as (path: _.Many<_.PropertyName>) => any; } // _.mixin @@ -7076,9 +6809,9 @@ fp.now(); // $ExpectType number // _.propertyOf { - _.propertyOf({}); // $ExpectType (path: Many) => any - _({}).propertyOf(); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> - _.chain({}).propertyOf(); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> + _.propertyOf({}) as (path: _.Many<_.PropertyName>) => any; + _({}).propertyOf() as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _.chain({}).propertyOf() as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; fp.propertyOf(Symbol.iterator)([]); // $ExpectType any fp.propertyOf([Symbol.iterator], []); // $ExpectType any @@ -7251,11 +6984,10 @@ _.templateSettings; // $ExpectType TemplateSettings // with arity 3 function _.partialRight(func3, 42, _, true); - fp.partial([], func0); // $ExpectType (...args: any[]) => any - fp.partial([])(func0); // $ExpectType (...args: any[]) => any - fp.partial([42])(func1); // $ExpectType (...args: any[]) => any - fp.partial([fp.partial.placeholder, "foo"])(func2); - fp.partialRight([])(func0); // $ExpectType (...args: any[]) => any - fp.partialRight([42])(func1); // $ExpectType (...args: any[]) => any - fp.partialRight([fp.partialRight.placeholder, "foo"])(func2); + fp.partial(func1, [42]); // $ExpectType Function0 + fp.partial(func1)([42]); // $ExpectType Function0 + fp.partial(func2)([fp.partial.placeholder, "foo"]); // $ExpectType Function1 + fp.partialRight(func1, [42]); // $ExpectType Function0 + fp.partialRight(func1)([42]); // $ExpectType Function0 + fp.partialRight(func2)([42, fp.partialRight.placeholder]); // $ExpectType Function1 } diff --git a/types/lodash/scripts/generate-fp.ts b/types/lodash/scripts/generate-fp.ts index 77f11b46ac..9a03fef544 100644 --- a/types/lodash/scripts/generate-fp.ts +++ b/types/lodash/scripts/generate-fp.ts @@ -174,15 +174,14 @@ async function processDefinitions(filePaths: string[], commonTypes: string[]): P } else if (args.length > 4 || definition.name === "flow" || definition.name === "flowRight") { // Arity wasn't fixed by convert() isFixed = false; - } else { - // For some reason, convert() doesn't seems to tell us which functions have unchanged argument order. - // So we have to hard-code it. - const unchangedOrders = ["add", "assign", "assignIn", "bind", "bindKey", "concat", "difference", "divide", "eq", - "gt", "gte", "isEqual", "lt", "lte", "matchesProperty", "merge", "multiply", "overArgs", "partial", "partialRight", - "propertyOf", "random", "range", "rangeRight", "subtract", "zip", "zipObject", "zipObjectDeep"]; - if (unchangedOrders.includes(definition.name)) - args = _.sortBy(args as number[][], (a: number[]) => a[0]); } + // For some reason, convert() doesn't seems to tell us which functions have unchanged argument order. + // So we have to hard-code it. + const unchangedOrders = ["add", "assign", "assignIn", "bind", "bindKey", "concat", "difference", "divide", "eq", + "gt", "gte", "isEqual", "lt", "lte", "matchesProperty", "merge", "multiply", "overArgs", "partial", "partialRight", + "propertyOf", "random", "range", "rangeRight", "subtract", "zip", "zipObject", "zipObjectDeep"]; + if (unchangedOrders.includes(definition.name)) + args = _.sortBy(args, a => typeof a === "number" ? a : a[0]); return () => curryDefinition(definition, _.flatten(args), spreadIndex, isFixed); }; @@ -324,6 +323,12 @@ function parseDefinitions(definitionString: string, startIndex: number, endIndex .map(o => _.trim(o, ",")) .filter(o => !!o); overload.returnType = overloadString.substring(paramEndIndex + 2).trim(); + // Special case for unset: the return type should be the input type, not bolean. See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/25361 + if (name === "unset") { + overload.typeParams = [{ name: "T" }]; + overload.params[0] = overload.params[0].replace(/\bany\b/, "T"); + overload.returnType = "T"; + } currentDefinition.overloads.push(overload); } else { // This overload actually points to an interface. Try to find said interface and get the overloads from there. @@ -433,25 +438,33 @@ function curryDefinition(definition: Definition, paramOrder: number[], spreadInd // Spread/rest parameters could be in any of the following formats: // 1. The rest parameter is at spreadIndex, and it is the last parameter. // 2. The rest parameter is immediately after spreadIndex, e.g. assign(object, ...sources[]). In this case, convert it to assignAll(...object[]) - // 3. The rest parameter is not the last parameter, e.g. assignWith(object, ...sources[], customizer) + // 3. The overload defines no rest parameters, e.g. mergeAll(T1, T2, T3) + // 4. The rest parameter is not the last parameter, e.g. assignWith(object, ...sources[], customizer) if (spreadIndex === arity - 1) { - // cases 1-2 for (let i = 0; i < overloads.length; ++i) { const overload = overloads[i]; if (overload.params.length === arity && overload.params[spreadIndex] && overload.params[spreadIndex].startsWith("...")) { + // case 1 overload.params[spreadIndex] = overload.params[spreadIndex].replace("...", ""); } else if (overload.params.length === arity + 1 && overload.params[spreadIndex + 1] && overload.params[spreadIndex + 1].startsWith("...")) { + // case 2 overload.params.splice(spreadIndex + 1, 1); const parts = overload.params[spreadIndex].split(":").map(_.trim); parts[1] = `ReadonlyArray<${parts[1]}>`; overload.params[spreadIndex] = `${parts[0]}: ${parts[1]}`; + } else if (overload.params.length >= arity && overload.params[spreadIndex] && !overload.params.some(p => p.startsWith("..."))) { + // case 3 + const paramName = getParamName(overload.params[spreadIndex]); + const spreadParamTypes = overload.params.slice(spreadIndex).map(getParamType); + overload.params = overload.params.slice(0, spreadIndex); + overload.params.push(`${paramName}: [${spreadParamTypes.join(", ")}]`); } else { _.pull(overloads, overload); --i; } } } else { - // case 3 + // case 4 const overload = overloads[0]; overloads = [{ jsdoc: overload.jsdoc, diff --git a/types/lowdb/_lodash.d.ts b/types/lowdb/_lodash.d.ts index 78ff4901af..a7d2c424f0 100644 --- a/types/lowdb/_lodash.d.ts +++ b/types/lowdb/_lodash.d.ts @@ -1263,11 +1263,15 @@ declare module "./index" { ): LoDashExplicitSyncWrapper; omit( this: LoDashExplicitSyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitSyncWrapper; + omit( + this: LoDashExplicitSyncWrapper, + ...paths: Array<_.Many> + ): LoDashExplicitSyncWrapper<_.Omit>; omit( this: LoDashExplicitSyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitSyncWrapper<_.PartialObject>; omitBy( this: LoDashExplicitSyncWrapper, @@ -2827,11 +2831,15 @@ declare module "./index" { ): LoDashExplicitAsyncWrapper; omit( this: LoDashExplicitAsyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitAsyncWrapper; + omit( + this: LoDashExplicitAsyncWrapper, + ...paths: Array<_.Many> + ): LoDashExplicitAsyncWrapper<_.Omit>; omit( this: LoDashExplicitAsyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitAsyncWrapper<_.PartialObject>; omitBy( this: LoDashExplicitAsyncWrapper,