Merge pull request #6910 from chrootsu/lodash-findKey

lodash: signatures of _.findKey have been changed
This commit is contained in:
Masahiro Wakame
2015-11-27 00:59:17 +09:00
2 changed files with 59 additions and 2 deletions
+26 -2
View File
@@ -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<string>) => boolean;
let result: string;
result = _.findKey<string, {a: string;}>({a: ''}, predicateFn);
result = _.findKey<string, {a: string;}>({a: ''}, predicateFn, any);
@@ -6072,6 +6072,30 @@ module TestFindKey {
result = _<{a: string;}>({a: ''}).findKey<string>(predicateFn);
result = _<{a: string;}>({a: ''}).findKey<string>(predicateFn, any);
}
{
let predicateFn: (value: any, key?: string, object?: {}) => boolean;
let result: _.LoDashExplicitWrapper<string>;
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<string>) => boolean;
let result: _.LoDashExplicitWrapper<string>;
result = _<{a: string;}>({a: ''}).chain().findKey<string>(predicateFn);
result = _<{a: string;}>({a: ''}).chain().findKey<string>(predicateFn, any);
}
}
// _.findLastKey
+33
View File
@@ -10412,6 +10412,39 @@ declare module _ {
): string;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.findKey
*/
findKey<TValues>(
predicate?: DictionaryIterator<TValues, boolean>,
thisArg?: any
): LoDashExplicitWrapper<string>;
/**
* @see _.findKey
*/
findKey(
predicate?: ObjectIterator<any, boolean>,
thisArg?: any
): LoDashExplicitWrapper<string>;
/**
* @see _.findKey
*/
findKey(
predicate?: string,
thisArg?: any
): LoDashExplicitWrapper<string>;
/**
* @see _.findKey
*/
findKey<TWhere extends Dictionary<any>>(
predicate?: TWhere
): LoDashExplicitWrapper<string>;
}
//_.findLastKey
interface LoDashStatic {
/**