lodash: signatures of _.findKey have been changed

This commit is contained in:
Ilya Mochalov
2015-11-24 04:59:13 +05:00
parent ba424f7ee3
commit a301b36205
2 changed files with 59 additions and 2 deletions
+26 -2
View File
@@ -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<string>) => boolean;
let result: string;
result = _.findKey<string, {a: string;}>({a: ''}, predicateFn);
result = _.findKey<string, {a: string;}>({a: ''}, predicateFn, any);
@@ -6045,6 +6045,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
@@ -10396,6 +10396,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 {
/**