Skip to content

Commit 049e87b

Browse files
author
Jed Mao
committed
Lodash union types, optional args
1 parent c594427 commit 049e87b

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
@@ -263,12 +263,12 @@ declare module _ {
263263
* @param array Array to compact.
264264
* @return (Array) Returns a new array of filtered values.
265265
**/
266-
compact<T>(array: Array<T>): T[];
266+
compact<T>(array?: Array<T>): T[];
267267

268268
/**
269269
* @see _.compact
270270
**/
271-
compact<T>(array: List<T>): T[];
271+
compact<T>(array?: List<T>): T[];
272272
}
273273

274274
interface LoDashArrayWrapper<T> {
@@ -288,13 +288,13 @@ declare module _ {
288288
* @return Returns a new array of filtered values.
289289
**/
290290
difference<T>(
291-
array: Array<T>,
291+
array?: Array<T>,
292292
...others: Array<T>[]): T[];
293293
/**
294294
* @see _.difference
295295
**/
296296
difference<T>(
297-
array: List<T>,
297+
array?: List<T>,
298298
...others: List<T>[]): T[];
299299
}
300300

@@ -432,12 +432,12 @@ declare module _ {
432432
* @param array Retrieves the first element of this array.
433433
* @return Returns the first element of `array`.
434434
**/
435-
first<T>(array: Array<T>): T;
435+
first<T>(array?: Array<T>): T;
436436

437437
/**
438438
* @see _.first
439439
**/
440-
first<T>(array: List<T>): T;
440+
first<T>(array?: List<T>): T;
441441

442442
/**
443443
* @see _.first
@@ -5663,7 +5663,7 @@ declare module _ {
56635663
* @param value The value to check.
56645664
* @return True if the value is an arguments object, else false.
56655665
**/
5666-
isArguments(value: any): boolean;
5666+
isArguments(value?: any): boolean;
56675667
}
56685668

56695669
//_.isArray
@@ -5673,7 +5673,7 @@ declare module _ {
56735673
* @param value The value to check.
56745674
* @return True if the value is an array, else false.
56755675
**/
5676-
isArray(value: any): boolean;
5676+
isArray(value?: any): boolean;
56775677
}
56785678

56795679
//_.isBoolean
@@ -5683,7 +5683,7 @@ declare module _ {
56835683
* @param value The value to check.
56845684
* @return True if the value is a boolean value, else false.
56855685
**/
5686-
isBoolean(value: any): boolean;
5686+
isBoolean(value?: any): boolean;
56875687
}
56885688

56895689
//_.isDate
@@ -5693,7 +5693,7 @@ declare module _ {
56935693
* @param value The value to check.
56945694
* @return True if the value is a date, else false.
56955695
**/
5696-
isDate(value: any): boolean;
5696+
isDate(value?: any): boolean;
56975697
}
56985698

56995699
//_.isElement
@@ -5703,7 +5703,7 @@ declare module _ {
57035703
* @param value The value to check.
57045704
* @return True if the value is a DOM element, else false.
57055705
**/
5706-
isElement(value: any): boolean;
5706+
isElement(value?: any): boolean;
57075707
}
57085708

57095709
//_.isEmpty
@@ -5714,22 +5714,7 @@ declare module _ {
57145714
* @param value The value to inspect.
57155715
* @return True if the value is empty, else false.
57165716
**/
5717-
isEmpty(value: any[]): boolean;
5718-
5719-
/**
5720-
* @see _.isEmpty
5721-
**/
5722-
isEmpty(value: Dictionary<any>): boolean;
5723-
5724-
/**
5725-
* @see _.isEmpty
5726-
**/
5727-
isEmpty(value: string): boolean;
5728-
5729-
/**
5730-
* @see _.isEmpty
5731-
**/
5732-
isEmpty(value: any): boolean;
5717+
isEmpty(value?: any[]|Dictionary<any>|string|any): boolean;
57335718
}
57345719

57355720
//_.isEqual
@@ -5746,8 +5731,8 @@ declare module _ {
57465731
* @return True if the values are equivalent, else false.
57475732
**/
57485733
isEqual(
5749-
a: any,
5750-
b: any,
5734+
a?: any,
5735+
b?: any,
57515736
callback?: (a: any, b: any) => boolean,
57525737
thisArg?: any): boolean;
57535738
}
@@ -5762,7 +5747,7 @@ declare module _ {
57625747
* @param value The value to check.
57635748
* @return True if the value is finite, else false.
57645749
**/
5765-
isFinite(value: any): boolean;
5750+
isFinite(value?: any): boolean;
57665751
}
57675752

57685753
//_.isFunction
@@ -5772,7 +5757,7 @@ declare module _ {
57725757
* @param value The value to check.
57735758
* @return True if the value is a function, else false.
57745759
**/
5775-
isFunction(value: any): boolean;
5760+
isFunction(value?: any): boolean;
57765761
}
57775762

57785763
//_.isNaN
@@ -5785,7 +5770,7 @@ declare module _ {
57855770
* @param value The value to check.
57865771
* @return True if the value is NaN, else false.
57875772
**/
5788-
isNaN(value: any): boolean;
5773+
isNaN(value?: any): boolean;
57895774
}
57905775

57915776
//_.isNull
@@ -5795,7 +5780,7 @@ declare module _ {
57955780
* @param value The value to check.
57965781
* @return True if the value is null, else false.
57975782
**/
5798-
isNull(value: any): boolean;
5783+
isNull(value?: any): boolean;
57995784
}
58005785

58015786
//_.isNumber
@@ -5807,7 +5792,7 @@ declare module _ {
58075792
* @param value The value to check.
58085793
* @return True if the value is a number, else false.
58095794
**/
5810-
isNumber(value: any): boolean;
5795+
isNumber(value?: any): boolean;
58115796
}
58125797

58135798
//_.isObject
@@ -5818,7 +5803,7 @@ declare module _ {
58185803
* @param value The value to check.
58195804
* @return True if the value is an object, else false.
58205805
**/
5821-
isObject(value: any): boolean;
5806+
isObject(value?: any): boolean;
58225807
}
58235808

58245809
//_.isPlainObject
@@ -5828,7 +5813,7 @@ declare module _ {
58285813
* @param value The value to check.
58295814
* @return True if value is a plain object, else false.
58305815
**/
5831-
isPlainObject(value: any): boolean;
5816+
isPlainObject(value?: any): boolean;
58325817
}
58335818

58345819
//_.isRegExp
@@ -5838,7 +5823,7 @@ declare module _ {
58385823
* @param value The value to check.
58395824
* @return True if the value is a regular expression, else false.
58405825
**/
5841-
isRegExp(value: any): boolean;
5826+
isRegExp(value?: any): boolean;
58425827
}
58435828

58445829
//_.isString
@@ -5848,7 +5833,7 @@ declare module _ {
58485833
* @param value The value to check.
58495834
* @return True if the value is a string, else false.
58505835
**/
5851-
isString(value: any): boolean;
5836+
isString(value?: any): boolean;
58525837
}
58535838

58545839
//_.isUndefined
@@ -5858,7 +5843,7 @@ declare module _ {
58585843
* @param value The value to check.
58595844
* @return True if the value is undefined, else false.
58605845
**/
5861-
isUndefined(value: any): boolean;
5846+
isUndefined(value?: any): boolean;
58625847
}
58635848

58645849
//_.keys
@@ -5868,7 +5853,7 @@ declare module _ {
58685853
* @param object The object to inspect.
58695854
* @return An array of property names.
58705855
**/
5871-
keys(object: any): string[];
5856+
keys(object?: any): string[];
58725857
}
58735858

58745859
interface LoDashObjectWrapper<T> {
@@ -6018,7 +6003,7 @@ declare module _ {
60186003
* @param object The object to inspect.
60196004
* @return Aew array of key-value pairs.
60206005
**/
6021-
pairs(object: any): any[][];
6006+
pairs(object?: any): any[][];
60226007
}
60236008

60246009
interface LoDashObjectWrapper<T> {
@@ -6130,7 +6115,7 @@ declare module _ {
61306115
* @param object The object to inspect.
61316116
* @return Returns an array of property values.
61326117
**/
6133-
values(object: any): any[];
6118+
values(object?: any): any[];
61346119
}
61356120

61366121
/**********
@@ -6156,10 +6141,8 @@ declare module _ {
61566141
trimLeft(str?: string, chars?: string): string;
61576142
trimRight(str?: string, chars?: string): string;
61586143
trunc(str?: string, len?: number): string;
6159-
trunc(str?: string, options?: { length?: number; omission?: string; separator?: string }): string;
6160-
trunc(str?: string, options?: { length?: number; omission?: string; separator?: RegExp }): string;
6161-
words(str?: string, pattern?: string): string[];
6162-
words(str?: string, pattern?: RegExp): string[];
6144+
trunc(str?: string, options?: { length?: number; omission?: string; separator?: string|RegExp }): string;
6145+
words(str?: string, pattern?: string|RegExp): string[];
61636146
}
61646147

61656148
//_.parseInt
@@ -6174,7 +6157,7 @@ declare module _ {
61746157
* @param radix The radix used to interpret the value to parse.
61756158
* @return The new integer value.
61766159
**/
6177-
parseInt(value: string, radix?: number): number;
6160+
parseInt(value?: string, radix?: number): number;
61786161
}
61796162

61806163
/*************
@@ -6187,7 +6170,7 @@ declare module _ {
61876170
* @param string The string to escape.
61886171
* @return The escaped string.
61896172
**/
6190-
escape(str: string): string;
6173+
escape(str?: string): string;
61916174
}
61926175

61936176
//_.identity
@@ -6197,7 +6180,7 @@ declare module _ {
61976180
* @param value Any value.
61986181
* @return value.
61996182
**/
6200-
identity<T>(value: T): T;
6183+
identity<T>(value?: T): T;
62016184
}
62026185

62036186
//_.mixin
@@ -6206,7 +6189,7 @@ declare module _ {
62066189
* Adds function properties of a source object to the lodash function and chainable wrapper.
62076190
* @param object The object of function properties to add to lodash.
62086191
**/
6209-
mixin(object: Dictionary<(value: any) => any>): void;
6192+
mixin(object?: Dictionary<(value: any) => any>): void;
62106193
}
62116194

62126195
//_.noConflict

0 commit comments

Comments
 (0)