diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 636efd813..43b95c756 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -406,35 +406,56 @@ module TestFindIndex { let array: TResult[]; let list: _.List; let predicateFn: (value: TResult, index?: number, collection?: _.List) => boolean; - let result: number; - result = _.findIndex(array); - result = _.findIndex(array, predicateFn); - result = _.findIndex(array, predicateFn, any); - result = _.findIndex(array, ''); - result = _.findIndex(array, '', any); - result = _.findIndex<{a: number}, TResult>(array, {a: 42}); + { + let result: number; - result = _.findIndex(list); - result = _.findIndex(list, predicateFn); - result = _.findIndex(list, predicateFn, any); - result = _.findIndex(list, ''); - result = _.findIndex(list, '', any); - result = _.findIndex<{a: number}, TResult>(list, {a: 42}); + result = _.findIndex(array); + result = _.findIndex(array, predicateFn); + result = _.findIndex(array, predicateFn, any); + result = _.findIndex(array, ''); + result = _.findIndex(array, '', any); + result = _.findIndex<{a: number}, TResult>(array, {a: 42}); - result = _(array).findIndex(); - result = _(array).findIndex(predicateFn); - result = _(array).findIndex(predicateFn, any); - result = _(array).findIndex(''); - result = _(array).findIndex('', any); - result = _(array).findIndex<{a: number}>({a: 42}); + result = _.findIndex(list); + result = _.findIndex(list, predicateFn); + result = _.findIndex(list, predicateFn, any); + result = _.findIndex(list, ''); + result = _.findIndex(list, '', any); + result = _.findIndex<{a: number}, TResult>(list, {a: 42}); - result = _(list).findIndex(); - result = _(list).findIndex(predicateFn); - result = _(list).findIndex(predicateFn, any); - result = _(list).findIndex(''); - result = _(list).findIndex('', any); - result = _(list).findIndex<{a: number}>({a: 42}); + result = _(array).findIndex(); + result = _(array).findIndex(predicateFn); + result = _(array).findIndex(predicateFn, any); + result = _(array).findIndex(''); + result = _(array).findIndex('', any); + result = _(array).findIndex<{a: number}>({a: 42}); + + result = _(list).findIndex(); + result = _(list).findIndex(predicateFn); + result = _(list).findIndex(predicateFn, any); + result = _(list).findIndex(''); + result = _(list).findIndex('', any); + result = _(list).findIndex<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().findIndex(); + result = _(array).chain().findIndex(predicateFn); + result = _(array).chain().findIndex(predicateFn, any); + result = _(array).chain().findIndex(''); + result = _(array).chain().findIndex('', any); + result = _(array).chain().findIndex<{a: number}>({a: 42}); + + result = _(list).chain().findIndex(); + result = _(list).chain().findIndex(predicateFn); + result = _(list).chain().findIndex(predicateFn, any); + result = _(list).chain().findIndex(''); + result = _(list).chain().findIndex('', any); + result = _(list).chain().findIndex<{a: number}>({a: 42}); + } } // _.findLastIndex diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 93d2b53cf..6401f31eb 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -765,6 +765,56 @@ declare module _ { ): number; } + interface LoDashExplicitArrayWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + //_.findLastIndex interface LoDashStatic { /**