diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 20a46fa827..f9fcdad509 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6184,10 +6184,9 @@ module TestFindKey { // _.findLastKey module TestFindLastKey { - let result: string; - { let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: string; result = _.findLastKey<{a: string;}>({a: ''}); @@ -6214,6 +6213,7 @@ module TestFindLastKey { { let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: string; result = _.findLastKey({a: ''}, predicateFn); result = _.findLastKey({a: ''}, predicateFn, any); @@ -6221,6 +6221,30 @@ module TestFindLastKey { result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); result = _<{a: string;}>({a: ''}).findLastKey(predicateFn, any); } + + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findLastKey(); + + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).chain().findLastKey(''); + result = _<{a: string;}>({a: ''}).chain().findLastKey('', any); + + result = _<{a: string;}>({a: ''}).chain().findLastKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); + } } // _.forIn diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index d32db4e481..97b82eacf4 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10620,6 +10620,39 @@ declare module _ { ): string; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + //_.forIn interface LoDashStatic { /**