diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index dbf8b1d5d..c2c650cfc 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6035,10 +6035,9 @@ module TestExtend { // _.findKey module TestFindKey { - let result: string; - { let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: string; result = _.findKey<{a: string;}>({a: ''}); @@ -6065,6 +6064,7 @@ module TestFindKey { { let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: string; result = _.findKey({a: ''}, predicateFn); result = _.findKey({a: ''}, predicateFn, any); @@ -6072,6 +6072,30 @@ module TestFindKey { result = _<{a: string;}>({a: ''}).findKey(predicateFn); result = _<{a: string;}>({a: ''}).findKey(predicateFn, any); } + + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findKey(); + + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).chain().findKey(''); + result = _<{a: string;}>({a: ''}).chain().findKey('', any); + + result = _<{a: string;}>({a: ''}).chain().findKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn, any); + } } // _.findLastKey diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index dd7c459a0..966f932b2 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10412,6 +10412,39 @@ declare module _ { ): string; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.findKey + */ + findKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + //_.findLastKey interface LoDashStatic { /**