diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 30c0b9934..4f9b1f493 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6008,10 +6008,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: ''}); @@ -6038,6 +6037,7 @@ module TestFindKey { { let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: string; result = _.findKey({a: ''}, predicateFn); result = _.findKey({a: ''}, predicateFn, any); @@ -6045,6 +6045,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 73a783b64..aa53e4fcc 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10396,6 +10396,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 { /**