diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index b295ea4db6..edb75b105d 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -6,7 +6,8 @@ // Eric L Anderson , // AJ Richardson , // Junyoung Clare Jang , -// e-cloud +// e-cloud , +// Georgii Dolzhykov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -474,9 +475,9 @@ declare namespace _ { * falsey. * * @param array The array to compact. - * @return (Array) Returns the new array of filtered values. + * @return Returns the new array of filtered values. */ - compact(array?: List | null | undefined): T[]; + compact(array: List | null | undefined): T[]; } interface LoDashImplicitWrapper { @@ -1338,14 +1339,14 @@ declare namespace _ { * // => { 'fred': 30, 'barney': 40 } */ fromPairs( - array: List<[StringRepresentable, T]> | null | undefined + pairs: List<[PropertyName, T]> | null | undefined ): Dictionary; /** @see _.fromPairs */ fromPairs( - array: List | null | undefined + pairs: List | null | undefined ): Dictionary; } @@ -1355,7 +1356,7 @@ declare namespace _ { * @see _.fromPairs */ fromPairs( - this: LoDashImplicitWrapper | null | undefined> + this: LoDashImplicitWrapper | null | undefined> ): LoDashImplicitWrapper>; /** @@ -1371,7 +1372,7 @@ declare namespace _ { * @see _.fromPairs */ fromPairs( - this: LoDashExplicitWrapper | null | undefined> + this: LoDashExplicitWrapper | null | undefined> ): LoDashExplicitWrapper>; /** @@ -1580,7 +1581,7 @@ declare namespace _ { * // => [{ 'x': 1 }] */ intersectionBy( - array?: List | null | undefined, + array: List | null | undefined, values?: List, iteratee?: ValueIteratee ): T[]; @@ -1589,7 +1590,7 @@ declare namespace _ { * @see _.intersectionBy */ intersectionBy( - array?: List | null | undefined, + array: List | null | undefined, ...values: Array | ValueIteratee>, ): T[]; } @@ -3337,7 +3338,7 @@ declare namespace _ { * // => [{ 'x': 2 }] */ xorBy( - arrays?: List | null | undefined, + arrays: List | null | undefined, iteratee?: ValueIteratee ): T[]; @@ -3439,7 +3440,7 @@ declare namespace _ { * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ xorWith( - arrays?: List | null | undefined, + arrays: List | null | undefined, comparator?: Comparator ): T[]; @@ -3563,108 +3564,79 @@ declare namespace _ { * @param values The property values. * @return Returns the new object. */ - zipObject( - props: List, - values: List - ): TResult; + zipObject( + props: List, + values: List + ): Dictionary; /** * @see _.zipObject */ zipObject( - props: List|List>, - values?: List - ): any; - - /** - * @see _.zipObject - */ - zipObject(): {}; + props?: List + ): Dictionary; /** * This method is like _.zipObject except that it supports property paths. * - * @param props The property names. + * @param paths The property names. * @param values The property values. * @return Returns the new object. */ zipObjectDeep( - props: List|List>, + paths?: List, values?: List - ): any; - - /** - * @see _.zipObjectDeep - */ - zipObjectDeep(): {}; + ): object; } interface LoDashImplicitWrapper { /** * @see _.zipObject */ - zipObject( - this: LoDashImplicitWrapper>, - values: List - ): LoDashImplicitWrapper; + zipObject( + this: LoDashImplicitWrapper>, + values: List + ): LoDashImplicitWrapper>; /** * @see _.zipObject */ zipObject( - this: LoDashImplicitWrapper|List>>, - values?: List - ): LoDashImplicitWrapper; + this: LoDashImplicitWrapper> + ): LoDashImplicitWrapper>; /** * @see _.zipObjectDeep */ zipObjectDeep( - this: LoDashImplicitWrapper|List>>, + this: LoDashImplicitWrapper>, values?: List - ): LoDashImplicitWrapper; - - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - this: LoDashImplicitWrapper|List>>, - values?: List - ): LoDashImplicitWrapper; + ): LoDashImplicitWrapper; } interface LoDashExplicitWrapper { /** * @see _.zipObject */ - zipObject( - this: LoDashExplicitWrapper>, - values: List - ): LoDashExplicitWrapper; + zipObject( + this: LoDashExplicitWrapper>, + values: List + ): LoDashExplicitWrapper>; /** * @see _.zipObject */ zipObject( - this: LoDashExplicitWrapper|List>>, - values?: List - ): LoDashExplicitWrapper; + this: LoDashExplicitWrapper> + ): LoDashExplicitWrapper>; /** * @see _.zipObjectDeep */ zipObjectDeep( - this: LoDashExplicitWrapper|List>>, + this: LoDashExplicitWrapper>, values?: List - ): LoDashExplicitWrapper; - - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - this: LoDashExplicitWrapper|List>>, - values?: List - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper; } //_.zipWith @@ -4020,7 +3992,7 @@ declare namespace _ { */ at( object: List | Dictionary | null | undefined, - ...props: Array> + ...props: PropertyPath[] ): T[]; /** @@ -4038,7 +4010,7 @@ declare namespace _ { */ at( this: LoDashImplicitWrapper | Dictionary | null | undefined>, - ...props: Array> + ...props: PropertyPath[] ): LoDashImplicitWrapper; /** @@ -4056,7 +4028,7 @@ declare namespace _ { */ at( this: LoDashExplicitWrapper | Dictionary | null | undefined>, - ...props: Array> + ...props: PropertyPath[] ): LoDashExplicitWrapper; /** @@ -5691,7 +5663,7 @@ declare namespace _ { **/ invoke( object: any, - path: Many, + path: PropertyPath, ...args: any[]): any; } @@ -5700,7 +5672,7 @@ declare namespace _ { * @see _.invoke **/ invoke( - path: Many, + path: PropertyPath, ...args: any[]): any; } @@ -5709,7 +5681,7 @@ declare namespace _ { * @see _.invoke **/ invoke( - path: Many, + path: PropertyPath, ...args: any[]): LoDashExplicitWrapper; } @@ -9173,7 +9145,7 @@ declare namespace _ { /** * @see _.isArrayLike */ - isArrayLike(value?: ((...args: any[]) => any) | Function | null | undefined): value is never; + isArrayLike(value: ((...args: any[]) => any) | Function | null | undefined): value is never; /** * @see _.isArrayLike @@ -9223,7 +9195,7 @@ declare namespace _ { /** * @see _.isArrayLike */ - isArrayLikeObject(value?: ((...args: any[]) => any) | Function | string | boolean | number | null | undefined): value is never; + isArrayLikeObject(value: ((...args: any[]) => any) | Function | string | boolean | number | null | undefined): value is never; /** * @see _.isArrayLike @@ -9423,7 +9395,7 @@ declare namespace _ { } // _.isEqualWith - type IsEqualCustomizer = (value: any, other: any, indexOrKey: number|string|undefined, parent: any, otherParent: any, stack: any) => boolean|undefined; + type IsEqualCustomizer = (value: any, other: any, indexOrKey: PropertyName | undefined, parent: any, otherParent: any, stack: any) => boolean|undefined; interface LoDashStatic { /** @@ -9668,7 +9640,7 @@ declare namespace _ { } //_.isMatch - type isMatchCustomizer = (value: any, other: any, indexOrKey?: number|string) => boolean; + type isMatchCustomizer = (value: any, other: any, indexOrKey?: PropertyName) => boolean; interface LoDashStatic { /** @@ -9702,7 +9674,7 @@ declare namespace _ { } //_.isMatchWith - type isMatchWithCustomizer = (value: any, other: any, indexOrKey: number|string) => boolean; + type isMatchWithCustomizer = (value: any, other: any, indexOrKey: PropertyName) => boolean; interface LoDashStatic { /** @@ -12888,7 +12860,7 @@ declare namespace _ { */ get( object: null | undefined, - path: Many, + path: PropertyPath, defaultValue: TDefault ): TDefault; @@ -12897,7 +12869,7 @@ declare namespace _ { */ get( object: null | undefined, - path: Many + path: PropertyPath ): undefined; /** @@ -12905,7 +12877,7 @@ declare namespace _ { */ get( object: any, - path: Many, + path: PropertyPath, defaultValue?: any ): any; } @@ -12940,7 +12912,7 @@ declare namespace _ { */ get( this: LoDashImplicitWrapper, - path: Many, + path: PropertyPath, defaultValue: TDefault ): TDefault; @@ -12949,14 +12921,14 @@ declare namespace _ { */ get( this: LoDashImplicitWrapper, - path: Many + path: PropertyPath ): undefined; /** * @see _.get */ get( - path: Many, + path: PropertyPath, defaultValue?: any ): any; } @@ -12991,7 +12963,7 @@ declare namespace _ { */ get( this: LoDashExplicitWrapper, - path: Many, + path: PropertyPath, defaultValue: TDefault ): LoDashExplicitWrapper; @@ -13000,14 +12972,14 @@ declare namespace _ { */ get( this: LoDashExplicitWrapper, - path: Many + path: PropertyPath ): LoDashExplicitWrapper; /** * @see _.get */ get( - path: Many, + path: PropertyPath, defaultValue?: any ): LoDashExplicitWrapper; } @@ -13040,7 +13012,7 @@ declare namespace _ { */ has( object: T, - path: Many + path: PropertyPath ): boolean; } @@ -13048,14 +13020,14 @@ declare namespace _ { /** * @see _.has */ - has(path: Many): boolean; + has(path: PropertyPath): boolean; } interface LoDashExplicitWrapper { /** * @see _.has */ - has(path: Many): LoDashExplicitWrapper; + has(path: PropertyPath): LoDashExplicitWrapper; } //_.hasIn @@ -13085,7 +13057,7 @@ declare namespace _ { */ hasIn( object: T, - path: Many + path: PropertyPath ): boolean; } @@ -13093,14 +13065,14 @@ declare namespace _ { /** * @see _.hasIn */ - hasIn(path: Many): boolean; + hasIn(path: PropertyPath): boolean; } interface LoDashExplicitWrapper { /** * @see _.hasIn */ - hasIn(path: Many): LoDashExplicitWrapper; + hasIn(path: PropertyPath): LoDashExplicitWrapper; } //_.invert @@ -13815,7 +13787,7 @@ declare namespace _ { * * @category Object * @param object The source object. - * @param [props] The property names to omit, specified + * @param [paths] The property names to omit, specified * individually or in arrays.. * @returns Returns the new object. * @example @@ -13825,30 +13797,53 @@ declare namespace _ { * _.omit(object, ['a', 'c']); * // => { 'b': '2' } */ + omit( + object: Dictionary, + ...paths: PropertyPath[] + ): Dictionary; + /** + * @see _.omit + */ omit( object: T | null | undefined, - ...props: Array> + ...paths: PropertyPath[] ): PartialObject; } interface LoDashImplicitWrapper { + /** + * @see _.omit + */ + omit( + this: LoDashImplicitWrapper>, + ...paths: PropertyPath[] + ): LoDashImplicitWrapper>; + /** * @see _.omit */ omit( this: LoDashImplicitWrapper, - ...props: Array> + ...paths: PropertyPath[] ): LoDashImplicitWrapper>; } interface LoDashExplicitWrapper { + /** + * @see _.omit + */ + omit( + this: LoDashExplicitWrapper>, + ...paths: PropertyPath[] + ): LoDashExplicitWrapper>; + /** * @see _.omit */ omit( this: LoDashExplicitWrapper, - ...predicate: Array> + ...paths: PropertyPath[] ): LoDashExplicitWrapper>; } @@ -13915,7 +13910,7 @@ declare namespace _ { */ pick( object: T | null | undefined, - ...predicate: Array> + ...props: PropertyPath[] ): PartialObject; } @@ -13925,7 +13920,7 @@ declare namespace _ { */ pick( this: LoDashImplicitWrapper, - ...predicate: Array> + ...props: PropertyPath[] ): LoDashImplicitWrapper>; } @@ -13935,7 +13930,7 @@ declare namespace _ { */ pick( this: LoDashExplicitWrapper, - ...predicate: Array> + ...props: PropertyPath[] ): LoDashExplicitWrapper>; } @@ -13995,7 +13990,7 @@ declare namespace _ { */ result( object: any, - path: Many, + path: PropertyPath, defaultValue?: TResult|((...args: any[]) => TResult) ): TResult; } @@ -14005,7 +14000,7 @@ declare namespace _ { * @see _.result */ result( - path: Many, + path: PropertyPath, defaultValue?: TResult|((...args: any[]) => TResult) ): TResult; } @@ -14015,7 +14010,7 @@ declare namespace _ { * @see _.result */ result( - path: Many, + path: PropertyPath, defaultValue?: TResult|((...args: any[]) => TResult) ): LoDashExplicitWrapper; } @@ -14034,7 +14029,7 @@ declare namespace _ { */ set( object: T, - path: Many, + path: PropertyPath, value: any ): T; @@ -14043,7 +14038,7 @@ declare namespace _ { */ set( object: object, - path: Many, + path: PropertyPath, value: any ): TResult; } @@ -14053,7 +14048,7 @@ declare namespace _ { * @see _.set */ set( - path: Many, + path: PropertyPath, value: any ): this; @@ -14061,7 +14056,7 @@ declare namespace _ { * @see _.set */ set( - path: Many, + path: PropertyPath, value: any ): LoDashImplicitWrapper; } @@ -14071,7 +14066,7 @@ declare namespace _ { * @see _.set */ set( - path: Many, + path: PropertyPath, value: any ): this; @@ -14079,7 +14074,7 @@ declare namespace _ { * @see _.set */ set( - path: Many, + path: PropertyPath, value: any ): LoDashExplicitWrapper; } @@ -14101,14 +14096,14 @@ declare namespace _ { */ setWith( object: T, - path: Many, + path: PropertyPath, value: any, customizer?: SetWithCustomizer ): T; setWith( object: T, - path: Many, + path: PropertyPath, value: any, customizer?: SetWithCustomizer ): TResult; @@ -14119,7 +14114,7 @@ declare namespace _ { * @see _.setWith */ setWith( - path: Many, + path: PropertyPath, value: any, customizer?: SetWithCustomizer ): this; @@ -14128,7 +14123,7 @@ declare namespace _ { * @see _.setWith */ setWith( - path: Many, + path: PropertyPath, value: any, customizer?: SetWithCustomizer ): LoDashImplicitWrapper; @@ -14139,7 +14134,7 @@ declare namespace _ { * @see _.setWith */ setWith( - path: Many, + path: PropertyPath, value: any, customizer?: SetWithCustomizer ): this; @@ -14148,7 +14143,7 @@ declare namespace _ { * @see _.setWith */ setWith( - path: Many, + path: PropertyPath, value: any, customizer?: SetWithCustomizer ): LoDashExplicitWrapper; @@ -14409,7 +14404,7 @@ declare namespace _ { */ unset( object: any, - path: Many + path: PropertyPath ): boolean; } @@ -14417,14 +14412,14 @@ declare namespace _ { /** * @see _.unset */ - unset(path: Many): LoDashImplicitWrapper; + unset(path: PropertyPath): LoDashImplicitWrapper; } interface LoDashExplicitWrapper { /** * @see _.unset */ - unset(path: Many): LoDashExplicitWrapper; + unset(path: PropertyPath): LoDashExplicitWrapper; } //_.update @@ -14440,7 +14435,7 @@ declare namespace _ { */ update( object: object, - path: Many, + path: PropertyPath, updater: (value: any) => any ): any; } @@ -14450,7 +14445,7 @@ declare namespace _ { * @see _.update */ update( - path: Many, + path: PropertyPath, updater: (value: any) => any ): LoDashImplicitWrapper; } @@ -14460,7 +14455,7 @@ declare namespace _ { * @see _.update */ update( - path: Many, + path: PropertyPath, updater: (value: any) => any ): LoDashExplicitWrapper; } @@ -14491,7 +14486,7 @@ declare namespace _ { */ updateWith( object: T, - path: Many, + path: PropertyPath, updater: (oldValue: any) => any, customizer?: SetWithCustomizer ): T; @@ -14501,7 +14496,7 @@ declare namespace _ { */ updateWith( object: T, - path: Many, + path: PropertyPath, updater: (oldValue: any) => any, customizer?: SetWithCustomizer ): TResult; @@ -14512,7 +14507,7 @@ declare namespace _ { * @see _.updateWith */ updateWith( - path: Many, + path: PropertyPath, updater: (oldValue: any) => any, customizer?: SetWithCustomizer ): this; @@ -14521,7 +14516,7 @@ declare namespace _ { * @see _.updateWith */ updateWith( - path: Many, + path: PropertyPath, updater: (oldValue: any) => any, customizer?: SetWithCustomizer ): LoDashImplicitWrapper; @@ -14532,7 +14527,7 @@ declare namespace _ { * @see _.updateWith */ updateWith( - path: Many, + path: PropertyPath, updater: (oldValue: any) => any, customizer?: SetWithCustomizer ): this; @@ -14541,7 +14536,7 @@ declare namespace _ { * @see _.updateWith */ updateWith( - path: Many, + path: PropertyPath, updater: (oldValue: any) => any, customizer?: SetWithCustomizer ): LoDashExplicitWrapper; @@ -15840,7 +15835,7 @@ declare namespace _ { * @return Returns the new function. */ matchesProperty( - path: Many, + path: PropertyPath, srcValue: T ): (value: any) => boolean; @@ -15848,7 +15843,7 @@ declare namespace _ { * @see _.matchesProperty */ matchesProperty( - path: Many, + path: PropertyPath, srcValue: T ): (value: V) => boolean; } @@ -15896,7 +15891,7 @@ declare namespace _ { * @return Returns the new function. */ method( - path: string|StringRepresentable[], + path: PropertyPath, ...args: any[] ): (object: any) => any; } @@ -15928,7 +15923,7 @@ declare namespace _ { methodOf( object: object, ...args: any[] - ): (path: Many) => any; + ): (path: PropertyPath) => any; } interface LoDashImplicitWrapper { @@ -15937,7 +15932,7 @@ declare namespace _ { */ methodOf( ...args: any[] - ): LoDashImplicitWrapper<(path: Many) => any>; + ): LoDashImplicitWrapper<(path: PropertyPath) => any>; } interface LoDashExplicitWrapper { @@ -15946,7 +15941,7 @@ declare namespace _ { */ methodOf( ...args: any[] - ): LoDashExplicitWrapper<(path: Many) => any>; + ): LoDashExplicitWrapper<(path: PropertyPath) => any>; } //_.mixin @@ -16182,7 +16177,7 @@ declare namespace _ { * @param path The path of the property to get. * @return Returns the new function. */ - property(path: Many): (obj: TObj) => TResult; + property(path: PropertyPath): (obj: TObj) => TResult; } interface LoDashImplicitWrapper { @@ -16208,21 +16203,21 @@ declare namespace _ { * @param object The object to query. * @return Returns the new function. */ - propertyOf(object: T): (path: Many) => any; + propertyOf(object: T): (path: PropertyPath) => any; } interface LoDashImplicitWrapper { /** * @see _.propertyOf */ - propertyOf(): LoDashImplicitWrapper<(path: Many) => any>; + propertyOf(): LoDashImplicitWrapper<(path: PropertyPath) => any>; } interface LoDashExplicitWrapper { /** * @see _.propertyOf */ - propertyOf(): LoDashExplicitWrapper<(path: Many) => any>; + propertyOf(): LoDashExplicitWrapper<(path: PropertyPath) => any>; } //_.range @@ -16609,6 +16604,9 @@ declare namespace _ { type ValueKeyIteratee = ((value: T, key: string) => any) | string | [string, any] | PartialDeep; type Comparator = (a: T, b: T) => boolean; + type PropertyName = string | number; + type PropertyPath = Many; + /** Common interface between Arrays and jQuery objects */ type List = ArrayLike; @@ -16620,10 +16618,6 @@ declare namespace _ { [index: number]: T; } - interface StringRepresentable { - toString(): string; - } - interface Cancelable { cancel(): void; flush(): void; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 19399ff23b..b030f48c31 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -215,7 +215,6 @@ namespace TestCompact { { let result: TResult[]; - result = _.compact(); result = _.compact(array); result = _.compact(list); result = _.compact(array2); @@ -2638,13 +2637,14 @@ namespace TestZip { // _.zipObject namespace TestZipObject { + const zipObjectResult = _.zipObject(['a', 'b'], [1, 2]); + const zipObjectDeepResult = _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); + let arrayOfKeys: string[] = []; let arrayOfValues: number[] = []; - let arrayOfKeyValuePairs: (string|number)[][] = []; let listOfKeys: _.List = []; let listOfValues: _.List = []; - let listOfKeyValuePairs: _.List<_.List> = []; { let result: _.Dictionary; @@ -2656,18 +2656,15 @@ namespace TestZipObject { { let result: _.Dictionary; - result = _.zipObject<_.Dictionary>(arrayOfKeys, arrayOfValues); - result = _.zipObject<_.Dictionary>(arrayOfKeys, listOfValues); - result = _.zipObject<_.Dictionary>(listOfKeys, listOfValues); - result = _.zipObject<_.Dictionary>(listOfKeys, arrayOfValues); - result = _.zipObject(arrayOfKeys, arrayOfValues); result = _.zipObject(arrayOfKeys, listOfValues); result = _.zipObject(listOfKeys, listOfValues); result = _.zipObject(listOfKeys, arrayOfValues); - result = _.zipObject(arrayOfKeyValuePairs); - result = _.zipObject(listOfKeyValuePairs); + result = _.zipObject(arrayOfKeys, arrayOfValues); + result = _.zipObject(arrayOfKeys, listOfValues); + result = _.zipObject(listOfKeys, listOfValues); + result = _.zipObject(listOfKeys, arrayOfValues); } { @@ -2686,9 +2683,6 @@ namespace TestZipObject { result = _.zipObjectDeep(listOfKeys, listOfValues); result = _.zipObject(listOfKeys, arrayOfValues); result = _.zipObjectDeep(listOfKeys, arrayOfValues); - - result = _.zipObject(arrayOfKeyValuePairs); - result = _.zipObject(listOfKeyValuePairs); } { @@ -2701,18 +2695,15 @@ namespace TestZipObject { { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(arrayOfKeys).zipObject<_.Dictionary>(arrayOfValues); - result = _(arrayOfKeys).zipObject<_.Dictionary>(listOfValues); - result = _(listOfKeys).zipObject<_.Dictionary>(listOfValues); - result = _(listOfKeys).zipObject<_.Dictionary>(arrayOfValues); - result = _(arrayOfKeys).zipObject(arrayOfValues); result = _(arrayOfKeys).zipObject(listOfValues); result = _(listOfKeys).zipObject(listOfValues); result = _(listOfKeys).zipObject(arrayOfValues); - result = _(listOfKeys).zipObject(arrayOfKeyValuePairs); - result = _(listOfKeys).zipObject(listOfKeyValuePairs); + result = _(arrayOfKeys).zipObject(arrayOfValues); + result = _(arrayOfKeys).zipObject(listOfValues); + result = _(listOfKeys).zipObject(listOfValues); + result = _(listOfKeys).zipObject(arrayOfValues); } { @@ -2731,11 +2722,6 @@ namespace TestZipObject { result = _(listOfKeys).zipObjectDeep(listOfValues); result = _(listOfKeys).zipObject(arrayOfValues); result = _(listOfKeys).zipObjectDeep(arrayOfValues); - - result = _(listOfKeys).zipObject(arrayOfKeyValuePairs); - result = _(listOfKeys).zipObjectDeep(arrayOfKeyValuePairs); - result = _(listOfKeys).zipObject(listOfKeyValuePairs); - result = _(listOfKeys).zipObjectDeep(listOfKeyValuePairs); } { @@ -2748,18 +2734,15 @@ namespace TestZipObject { { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(arrayOfKeys).chain().zipObject<_.Dictionary>(arrayOfValues); - result = _(arrayOfKeys).chain().zipObject<_.Dictionary>(listOfValues); - result = _(listOfKeys).chain().zipObject<_.Dictionary>(listOfValues); - result = _(listOfKeys).chain().zipObject<_.Dictionary>(arrayOfValues); - result = _(arrayOfKeys).chain().zipObject(arrayOfValues); result = _(arrayOfKeys).chain().zipObject(listOfValues); result = _(listOfKeys).chain().zipObject(listOfValues); result = _(listOfKeys).chain().zipObject(arrayOfValues); - result = _(listOfKeys).chain().zipObject(arrayOfKeyValuePairs); - result = _(listOfKeys).chain().zipObject(listOfKeyValuePairs); + result = _(arrayOfKeys).chain().zipObject(arrayOfValues); + result = _(arrayOfKeys).chain().zipObject(listOfValues); + result = _(listOfKeys).chain().zipObject(listOfValues); + result = _(listOfKeys).chain().zipObject(arrayOfValues); } { @@ -2778,11 +2761,6 @@ namespace TestZipObject { result = _(listOfKeys).chain().zipObjectDeep(listOfValues); result = _(listOfKeys).chain().zipObject(arrayOfValues); result = _(listOfKeys).chain().zipObjectDeep(arrayOfValues); - - result = _(listOfKeys).chain().zipObject(arrayOfKeyValuePairs); - result = _(listOfKeys).chain().zipObjectDeep(arrayOfKeyValuePairs); - result = _(listOfKeys).chain().zipObject(listOfKeyValuePairs); - result = _(listOfKeys).chain().zipObjectDeep(listOfKeyValuePairs); } } @@ -10738,13 +10716,11 @@ namespace TestHas { result = _.has(object, ''); result = _.has(object, 42); - result = _.has(object, true); - result = _.has(object, ['', 42, true]); + result = _.has(object, ['', 42]); result = _(object).has(''); result = _(object).has(42); - result = _(object).has(true); - result = _(object).has(['', 42, true]); + result = _(object).has(['', 42]); } { @@ -10752,8 +10728,7 @@ namespace TestHas { result = _(object).chain().has(''); result = _(object).chain().has(42); - result = _(object).chain().has(true); - result = _(object).chain().has(['', 42, true]); + result = _(object).chain().has(['', 42]); } } @@ -10768,13 +10743,11 @@ namespace TestHasIn { result = _.hasIn(object, ''); result = _.hasIn(object, 42); - result = _.hasIn(object, true); - result = _.hasIn(object, ['', 42, true]); + result = _.hasIn(object, ['', 42]); result = _(object).hasIn(''); result = _(object).hasIn(42); - result = _(object).hasIn(true); - result = _(object).hasIn(['', 42, true]); + result = _(object).hasIn(['', 42]); } { @@ -10782,8 +10755,7 @@ namespace TestHasIn { result = _(object).chain().hasIn(''); result = _(object).chain().hasIn(42); - result = _(object).chain().hasIn(true); - result = _(object).chain().hasIn(['', 42, true]); + result = _(object).chain().hasIn(['', 42]); } } @@ -11139,33 +11111,36 @@ namespace TestMergeWith { // _.omit namespace TestOmit { let obj: TResult | null | undefined = any; - let predicate: (element: any, key: string, collection: any) => boolean; + let dict: { [key: string]: TResult } = { }; { let result: Partial; result = _.omit(obj, 'a'); result = _.omit(obj, 0, 'a'); - result = _.omit(obj, true, 0, 'a'); - result = _.omit(obj, ['b', 1, false], true, 0, 'a'); + result = _.omit(obj, ['b', 1], 0, 'a'); + + dict = _.omit(dict, 'a'); } { let result: _.LoDashImplicitWrapper>; - result = _(obj).omit('a'); - result = _(obj).omit(0, 'a'); - result = _(obj).omit(true, 0, 'a'); - result = _(obj).omit(['b', 1, false], true, 0, 'a'); + result = _(obj).omit('a'); + result = _(obj).omit(0, 'a'); + result = _(obj).omit(['b', 1], 0, 'a'); + + dict = _(dict).omit('a').value(); } { let result: _.LoDashExplicitWrapper>; - result = _(obj).chain().omit('a'); - result = _(obj).chain().omit(0, 'a'); - result = _(obj).chain().omit(true, 0, 'a'); - result = _(obj).chain().omit(['b', 1, false], true, 0, 'a'); + result = _(obj).chain().omit('a'); + result = _(obj).chain().omit(0, 'a'); + result = _(obj).chain().omit(['b', 1], 0, 'a'); + + dict = _(dict).chain().omit('a').value(); } } @@ -11202,8 +11177,7 @@ namespace TestPick { result = _.pick(obj, 'a'); result = _.pick(obj, 0, 'a'); - result = _.pick(obj, true, 0, 'a'); - result = _.pick(obj, ['b', 1, false], true, 0, 'a'); + result = _.pick(obj, ['b', 1], 0, 'a'); } { @@ -11211,8 +11185,7 @@ namespace TestPick { result = _(obj).pick('a'); result = _(obj).pick(0, 'a'); - result = _(obj).pick(true, 0, 'a'); - result = _(obj).pick(['b', 1, false], true, 0, 'a'); + result = _(obj).pick(['b', 1], 0, 'a'); } { @@ -11220,8 +11193,7 @@ namespace TestPick { result = _(obj).chain().pick('a'); result = _(obj).chain().pick(0, 'a'); - result = _(obj).chain().pick(true, 0, 'a'); - result = _(obj).chain().pick(['b', 1, false], true, 0, 'a'); + result = _(obj).chain().pick(['b', 1], 0, 'a'); } } @@ -12746,7 +12718,7 @@ namespace TestMatches { // _.matchesProperty namespace TestMatches { - let path: {toString(): string;}|{toString(): string;}[] = []; + let path: string | string[] = []; let source: TResult = { a: 1, b: "", c: true }; { @@ -12874,7 +12846,7 @@ namespace TestMethod { // _.methodOf namespace TestMethodOf { type SampleObject = { a: { b(): TResult }[] }; - type ResultFn = (path: _.StringRepresentable|_.StringRepresentable[]) => TResult; + type ResultFn = (path: string | string[]) => TResult; let object: SampleObject = { a: [] }; diff --git a/types/lodash/tslint.json b/types/lodash/tslint.json index 0f69e71c84..44e681fc18 100644 --- a/types/lodash/tslint.json +++ b/types/lodash/tslint.json @@ -14,7 +14,6 @@ "no-empty-interface": false, "no-mergeable-namespace": false, "no-namespace": false, - "no-redundant-undefined": false, "no-unnecessary-generics": false, "no-unnecessary-type-assertion": false, "no-void-expression": false,