Skip to content

Commit 207fc2a

Browse files
committed
Merge pull request DefinitelyTyped#3930 from jedmao/lodash
Lodash union types, optional args
2 parents a06fdbd + 049e87b commit 207fc2a

File tree

1 file changed

+33
-50
lines changed

1 file changed

+33
-50
lines changed

lodash/lodash.d.ts

Lines changed: 33 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,12 @@ declare module _ {
287287
* @param array Array to compact.
288288
* @return (Array) Returns a new array of filtered values.
289289
**/
290-
compact<T>(array: Array<T>): T[];
290+
compact<T>(array?: Array<T>): T[];
291291

292292
/**
293293
* @see _.compact
294294
**/
295-
compact<T>(array: List<T>): T[];
295+
compact<T>(array?: List<T>): T[];
296296
}
297297

298298
interface LoDashArrayWrapper<T> {
@@ -312,13 +312,13 @@ declare module _ {
312312
* @return Returns a new array of filtered values.
313313
**/
314314
difference<T>(
315-
array: Array<T>,
315+
array?: Array<T>,
316316
...others: Array<T>[]): T[];
317317
/**
318318
* @see _.difference
319319
**/
320320
difference<T>(
321-
array: List<T>,
321+
array?: List<T>,
322322
...others: List<T>[]): T[];
323323
}
324324

@@ -456,12 +456,12 @@ declare module _ {
456456
* @param array Retrieves the first element of this array.
457457
* @return Returns the first element of `array`.
458458
**/
459-
first<T>(array: Array<T>): T;
459+
first<T>(array?: Array<T>): T;
460460

461461
/**
462462
* @see _.first
463463
**/
464-
first<T>(array: List<T>): T;
464+
first<T>(array?: List<T>): T;
465465

466466
/**
467467
* @see _.first
@@ -5701,7 +5701,7 @@ declare module _ {
57015701
* @param value The value to check.
57025702
* @return True if the value is an arguments object, else false.
57035703
**/
5704-
isArguments(value: any): boolean;
5704+
isArguments(value?: any): boolean;
57055705
}
57065706

57075707
//_.isArray
@@ -5711,7 +5711,7 @@ declare module _ {
57115711
* @param value The value to check.
57125712
* @return True if the value is an array, else false.
57135713
**/
5714-
isArray(value: any): boolean;
5714+
isArray(value?: any): boolean;
57155715
}
57165716

57175717
//_.isBoolean
@@ -5721,7 +5721,7 @@ declare module _ {
57215721
* @param value The value to check.
57225722
* @return True if the value is a boolean value, else false.
57235723
**/
5724-
isBoolean(value: any): boolean;
5724+
isBoolean(value?: any): boolean;
57255725
}
57265726

57275727
//_.isDate
@@ -5731,7 +5731,7 @@ declare module _ {
57315731
* @param value The value to check.
57325732
* @return True if the value is a date, else false.
57335733
**/
5734-
isDate(value: any): boolean;
5734+
isDate(value?: any): boolean;
57355735
}
57365736

57375737
//_.isElement
@@ -5741,7 +5741,7 @@ declare module _ {
57415741
* @param value The value to check.
57425742
* @return True if the value is a DOM element, else false.
57435743
**/
5744-
isElement(value: any): boolean;
5744+
isElement(value?: any): boolean;
57455745
}
57465746

57475747
//_.isEmpty
@@ -5752,22 +5752,7 @@ declare module _ {
57525752
* @param value The value to inspect.
57535753
* @return True if the value is empty, else false.
57545754
**/
5755-
isEmpty(value: any[]): boolean;
5756-
5757-
/**
5758-
* @see _.isEmpty
5759-
**/
5760-
isEmpty(value: Dictionary<any>): boolean;
5761-
5762-
/**
5763-
* @see _.isEmpty
5764-
**/
5765-
isEmpty(value: string): boolean;
5766-
5767-
/**
5768-
* @see _.isEmpty
5769-
**/
5770-
isEmpty(value: any): boolean;
5755+
isEmpty(value?: any[]|Dictionary<any>|string|any): boolean;
57715756
}
57725757

57735758
//_.isError
@@ -5796,8 +5781,8 @@ declare module _ {
57965781
* @return True if the values are equivalent, else false.
57975782
**/
57985783
isEqual(
5799-
a: any,
5800-
b: any,
5784+
a?: any,
5785+
b?: any,
58015786
callback?: (a: any, b: any) => boolean,
58025787
thisArg?: any): boolean;
58035788
}
@@ -5812,7 +5797,7 @@ declare module _ {
58125797
* @param value The value to check.
58135798
* @return True if the value is finite, else false.
58145799
**/
5815-
isFinite(value: any): boolean;
5800+
isFinite(value?: any): boolean;
58165801
}
58175802

58185803
//_.isFunction
@@ -5822,7 +5807,7 @@ declare module _ {
58225807
* @param value The value to check.
58235808
* @return True if the value is a function, else false.
58245809
**/
5825-
isFunction(value: any): boolean;
5810+
isFunction(value?: any): boolean;
58265811
}
58275812

58285813
//_.isNaN
@@ -5835,7 +5820,7 @@ declare module _ {
58355820
* @param value The value to check.
58365821
* @return True if the value is NaN, else false.
58375822
**/
5838-
isNaN(value: any): boolean;
5823+
isNaN(value?: any): boolean;
58395824
}
58405825

58415826
//_.isNull
@@ -5845,7 +5830,7 @@ declare module _ {
58455830
* @param value The value to check.
58465831
* @return True if the value is null, else false.
58475832
**/
5848-
isNull(value: any): boolean;
5833+
isNull(value?: any): boolean;
58495834
}
58505835

58515836
//_.isNumber
@@ -5857,7 +5842,7 @@ declare module _ {
58575842
* @param value The value to check.
58585843
* @return True if the value is a number, else false.
58595844
**/
5860-
isNumber(value: any): boolean;
5845+
isNumber(value?: any): boolean;
58615846
}
58625847

58635848
//_.isObject
@@ -5868,7 +5853,7 @@ declare module _ {
58685853
* @param value The value to check.
58695854
* @return True if the value is an object, else false.
58705855
**/
5871-
isObject(value: any): boolean;
5856+
isObject(value?: any): boolean;
58725857
}
58735858

58745859
//_.isPlainObject
@@ -5878,7 +5863,7 @@ declare module _ {
58785863
* @param value The value to check.
58795864
* @return True if value is a plain object, else false.
58805865
**/
5881-
isPlainObject(value: any): boolean;
5866+
isPlainObject(value?: any): boolean;
58825867
}
58835868

58845869
//_.isRegExp
@@ -5888,7 +5873,7 @@ declare module _ {
58885873
* @param value The value to check.
58895874
* @return True if the value is a regular expression, else false.
58905875
**/
5891-
isRegExp(value: any): boolean;
5876+
isRegExp(value?: any): boolean;
58925877
}
58935878

58945879
//_.isString
@@ -5898,7 +5883,7 @@ declare module _ {
58985883
* @param value The value to check.
58995884
* @return True if the value is a string, else false.
59005885
**/
5901-
isString(value: any): boolean;
5886+
isString(value?: any): boolean;
59025887
}
59035888

59045889
//_.isUndefined
@@ -5908,7 +5893,7 @@ declare module _ {
59085893
* @param value The value to check.
59095894
* @return True if the value is undefined, else false.
59105895
**/
5911-
isUndefined(value: any): boolean;
5896+
isUndefined(value?: any): boolean;
59125897
}
59135898

59145899
//_.keys
@@ -5918,7 +5903,7 @@ declare module _ {
59185903
* @param object The object to inspect.
59195904
* @return An array of property names.
59205905
**/
5921-
keys(object: any): string[];
5906+
keys(object?: any): string[];
59225907
}
59235908

59245909
interface LoDashObjectWrapper<T> {
@@ -6068,7 +6053,7 @@ declare module _ {
60686053
* @param object The object to inspect.
60696054
* @return Aew array of key-value pairs.
60706055
**/
6071-
pairs(object: any): any[][];
6056+
pairs(object?: any): any[][];
60726057
}
60736058

60746059
interface LoDashObjectWrapper<T> {
@@ -6180,7 +6165,7 @@ declare module _ {
61806165
* @param object The object to inspect.
61816166
* @return Returns an array of property values.
61826167
**/
6183-
values(object: any): any[];
6168+
values(object?: any): any[];
61846169
}
61856170

61866171
/**********
@@ -6206,10 +6191,8 @@ declare module _ {
62066191
trimLeft(str?: string, chars?: string): string;
62076192
trimRight(str?: string, chars?: string): string;
62086193
trunc(str?: string, len?: number): string;
6209-
trunc(str?: string, options?: { length?: number; omission?: string; separator?: string }): string;
6210-
trunc(str?: string, options?: { length?: number; omission?: string; separator?: RegExp }): string;
6211-
words(str?: string, pattern?: string): string[];
6212-
words(str?: string, pattern?: RegExp): string[];
6194+
trunc(str?: string, options?: { length?: number; omission?: string; separator?: string|RegExp }): string;
6195+
words(str?: string, pattern?: string|RegExp): string[];
62136196
}
62146197

62156198
//_.parseInt
@@ -6224,7 +6207,7 @@ declare module _ {
62246207
* @param radix The radix used to interpret the value to parse.
62256208
* @return The new integer value.
62266209
**/
6227-
parseInt(value: string, radix?: number): number;
6210+
parseInt(value?: string, radix?: number): number;
62286211
}
62296212

62306213
/*************
@@ -6237,7 +6220,7 @@ declare module _ {
62376220
* @param string The string to escape.
62386221
* @return The escaped string.
62396222
**/
6240-
escape(str: string): string;
6223+
escape(str?: string): string;
62416224
}
62426225

62436226
//_.identity
@@ -6247,7 +6230,7 @@ declare module _ {
62476230
* @param value Any value.
62486231
* @return value.
62496232
**/
6250-
identity<T>(value: T): T;
6233+
identity<T>(value?: T): T;
62516234
}
62526235

62536236
//_.mixin
@@ -6256,7 +6239,7 @@ declare module _ {
62566239
* Adds function properties of a source object to the lodash function and chainable wrapper.
62576240
* @param object The object of function properties to add to lodash.
62586241
**/
6259-
mixin(object: Dictionary<(value: any) => any>): void;
6242+
mixin(object?: Dictionary<(value: any) => any>): void;
62606243
}
62616244

62626245
//_.noConflict

0 commit comments

Comments
 (0)