Skip to content

Commit 5e53d53

Browse files
committed
Merge pull request DefinitelyTyped#6910 from chrootsu/lodash-findKey
lodash: signatures of _.findKey have been changed
2 parents 819292a + a301b36 commit 5e53d53

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed

lodash/lodash-tests.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6035,10 +6035,9 @@ module TestExtend {
60356035

60366036
// _.findKey
60376037
module TestFindKey {
6038-
let result: string;
6039-
60406038
{
60416039
let predicateFn: (value: any, key?: string, object?: {}) => boolean;
6040+
let result: string;
60426041

60436042
result = _.findKey<{a: string;}>({a: ''});
60446043

@@ -6065,13 +6064,38 @@ module TestFindKey {
60656064

60666065
{
60676066
let predicateFn: (value: string, key?: string, collection?: _.Dictionary<string>) => boolean;
6067+
let result: string;
60686068

60696069
result = _.findKey<string, {a: string;}>({a: ''}, predicateFn);
60706070
result = _.findKey<string, {a: string;}>({a: ''}, predicateFn, any);
60716071

60726072
result = _<{a: string;}>({a: ''}).findKey<string>(predicateFn);
60736073
result = _<{a: string;}>({a: ''}).findKey<string>(predicateFn, any);
60746074
}
6075+
6076+
{
6077+
let predicateFn: (value: any, key?: string, object?: {}) => boolean;
6078+
let result: _.LoDashExplicitWrapper<string>;
6079+
6080+
result = _<{a: string;}>({a: ''}).chain().findKey();
6081+
6082+
result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn);
6083+
result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn, any);
6084+
6085+
6086+
result = _<{a: string;}>({a: ''}).chain().findKey('');
6087+
result = _<{a: string;}>({a: ''}).chain().findKey('', any);
6088+
6089+
result = _<{a: string;}>({a: ''}).chain().findKey<{a: number;}>({a: 42});
6090+
}
6091+
6092+
{
6093+
let predicateFn: (value: string, key?: string, collection?: _.Dictionary<string>) => boolean;
6094+
let result: _.LoDashExplicitWrapper<string>;
6095+
6096+
result = _<{a: string;}>({a: ''}).chain().findKey<string>(predicateFn);
6097+
result = _<{a: string;}>({a: ''}).chain().findKey<string>(predicateFn, any);
6098+
}
60756099
}
60766100

60776101
// _.findLastKey

lodash/lodash.d.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10412,6 +10412,39 @@ declare module _ {
1041210412
): string;
1041310413
}
1041410414

10415+
interface LoDashExplicitObjectWrapper<T> {
10416+
/**
10417+
* @see _.findKey
10418+
*/
10419+
findKey<TValues>(
10420+
predicate?: DictionaryIterator<TValues, boolean>,
10421+
thisArg?: any
10422+
): LoDashExplicitWrapper<string>;
10423+
10424+
/**
10425+
* @see _.findKey
10426+
*/
10427+
findKey(
10428+
predicate?: ObjectIterator<any, boolean>,
10429+
thisArg?: any
10430+
): LoDashExplicitWrapper<string>;
10431+
10432+
/**
10433+
* @see _.findKey
10434+
*/
10435+
findKey(
10436+
predicate?: string,
10437+
thisArg?: any
10438+
): LoDashExplicitWrapper<string>;
10439+
10440+
/**
10441+
* @see _.findKey
10442+
*/
10443+
findKey<TWhere extends Dictionary<any>>(
10444+
predicate?: TWhere
10445+
): LoDashExplicitWrapper<string>;
10446+
}
10447+
1041510448
//_.findLastKey
1041610449
interface LoDashStatic {
1041710450
/**

0 commit comments

Comments
 (0)