From 4997d6c861d7a1b07b4ab5f190d617576bdf9d9f Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 31 Oct 2015 19:59:23 +0500 Subject: [PATCH] lodash: signatures of the method _.findIndex changed --- lodash/lodash-tests.ts | 71 +++++++++++++++++++++++++++--------------- lodash/lodash.d.ts | 50 +++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 25 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 3afc49041..9532eb2b2 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -313,35 +313,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 d143f4e65..63655b009 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -673,6 +673,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 { /**