diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 13416355d9..99413aff8f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -177,6 +177,16 @@ result = _.tail([1, 2, 3], (num) => num < 3) result = _.tail(foodsOrganic, 'test') result = _.tail(foodsType, { 'type': 'value' }) +// _.fill +var testFillArray = [1, 2, 3]; +var testFillList: _.List = {0: 1, 1: 2, 2: 3, length: 3}; + +result = _.fill(testFillArray, 'a', 0, 3); +result = <_.List>_.fill(testFillList, 'a', 0, 3); +result = _(testFillArray).fill(0, 0, 3).value(); +result = <_.List>_(testFillList).fill(0, 0, 3).value(); + + result = _.findIndex(['apple', 'banana', 'beet'], function (f) { return /^b/.test(f); }); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index fe3916a986..a576ee0330 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2491,24 +2491,54 @@ declare module _ { collection: Dictionary, whereValue: W): boolean; } - + + //_.fill interface LoDashStatic { - /** - * Fills elements of array with value from start up to, but not including, end. - * - * Note: This method mutates array. - * - * @param array (Array): The array to fill. - * @param value (*): The value to fill array with. - * @param [start=0] (number): The start position. - * @param [end=array.length] (number): The end position. - * @return (Array): Returns array. - **/ - fill( - array: Array, - value: any, - start?: number, - end?: number): Array; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array (Array): The array to fill. + * @param value (*): The value to fill array with. + * @param [start=0] (number): The start position. + * @param [end=array.length] (number): The end position. + * @return (Array): Returns array. + */ + fill( + array: any[], + value: any, + start?: number, + end?: number): TResult[]; + + /** + * @see _.fill + */ + fill( + array: List, + value: any, + start?: number, + end?: number): List; + } + + interface LoDashArrayWrapper { + /** + * @see _.fill + */ + fill( + value: any, + start?: number, + end?: number): LoDashArrayWrapper; + } + + interface LoDashObjectWrapper { + /** + * @see _.fill + */ + fill( + value: any, + start?: number, + end?: number): LoDashObjectWrapper>; } //_.filter