diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 11c4bcbfb..7fd164725 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4775,65 +4775,67 @@ module TestSize { } // _.some -module TestSome { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; - let numericDictionary: _.NumericDictionary; +namespace TestSome { + type SampleObject = {a: number; b: string; c: boolean;}; - let listIterator: (value: TResult, index: number, collection: _.List) => boolean; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; - let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => boolean; + let array: SampleObject[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + let listIterator: (value: SampleObject, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: SampleObject, key: string, collection: _.Dictionary) => boolean; + let numericDictionaryIterator: (value: SampleObject, key: number, collection: _.NumericDictionary) => boolean; { let result: boolean; - result = _.some(array); - result = _.some(array, listIterator); - result = _.some(array, listIterator, any); - result = _.some(array, ''); - result = _.some<{a: number}, TResult>(array, {a: 42}); + result = _.some(array); + result = _.some(array, listIterator); + result = _.some(array, 'a'); + result = _.some(array, ['a', 42]); + result = _.some<{a: number}, SampleObject>(array, {a: 42}); - result = _.some(list); - result = _.some(list, listIterator); - result = _.some(list, listIterator, any); - result = _.some(list, ''); - result = _.some<{a: number}, TResult>(list, {a: 42}); + result = _.some(list); + result = _.some(list, listIterator); + result = _.some(list, 'a'); + result = _.some(list, ['a', 42]); + result = _.some<{a: number}, SampleObject>(list, {a: 42}); - result = _.some(dictionary); - result = _.some(dictionary, dictionaryIterator); - result = _.some(dictionary, dictionaryIterator, any); - result = _.some(dictionary, ''); - result = _.some<{a: number}, TResult>(dictionary, {a: 42}); + result = _.some(dictionary); + result = _.some(dictionary, dictionaryIterator); + result = _.some(dictionary, 'a'); + result = _.some(dictionary, ['a', 42]); + result = _.some<{a: number}, SampleObject>(dictionary, {a: 42}); - result = _.some(numericDictionary); - result = _.some(numericDictionary, numericDictionaryIterator); - result = _.some(numericDictionary, numericDictionaryIterator, any); - result = _.some(numericDictionary, ''); - result = _.some<{a: number}, TResult>(numericDictionary, {a: 42}); + result = _.some(numericDictionary); + result = _.some(numericDictionary, numericDictionaryIterator); + result = _.some(numericDictionary, 'a'); + result = _.some(numericDictionary, ['a', 42]); + result = _.some<{a: number}, SampleObject>(numericDictionary, {a: 42}); result = _(array).some(); result = _(array).some(listIterator); - result = _(array).some(listIterator, any); - result = _(array).some(''); + result = _(array).some('a'); + result = _(array).some(['a', 42]); result = _(array).some<{a: number}>({a: 42}); - result = _(list).some(); - result = _(list).some(listIterator); - result = _(list).some(listIterator, any); - result = _(list).some(''); + result = _(list).some(); + result = _(list).some(listIterator); + result = _(list).some('a'); + result = _(list).some(['a', 42]); result = _(list).some<{a: number}>({a: 42}); - result = _(dictionary).some(); - result = _(dictionary).some(dictionaryIterator); - result = _(dictionary).some(dictionaryIterator, any); - result = _(dictionary).some(''); + result = _(dictionary).some(); + result = _(dictionary).some(dictionaryIterator); + result = _(dictionary).some('a'); + result = _(dictionary).some(['a', 42]); result = _(dictionary).some<{a: number}>({a: 42}); - result = _(numericDictionary).some(); - result = _(numericDictionary).some(numericDictionaryIterator); - result = _(numericDictionary).some(numericDictionaryIterator, any); - result = _(numericDictionary).some(''); + result = _(numericDictionary).some(); + result = _(numericDictionary).some(numericDictionaryIterator); + result = _(numericDictionary).some('a'); + result = _(numericDictionary).some(['a', 42]); result = _(numericDictionary).some<{a: number}>({a: 42}); } @@ -4842,26 +4844,26 @@ module TestSome { result = _(array).chain().some(); result = _(array).chain().some(listIterator); - result = _(array).chain().some(listIterator, any); - result = _(array).chain().some(''); + result = _(array).chain().some('a'); + result = _(array).chain().some(['a', 42]); result = _(array).chain().some<{a: number}>({a: 42}); - result = _(list).chain().some(); - result = _(list).chain().some(listIterator); - result = _(list).chain().some(listIterator, any); - result = _(list).chain().some(''); + result = _(list).chain().some(); + result = _(list).chain().some(listIterator); + result = _(list).chain().some('a'); + result = _(list).chain().some(['a', 42]); result = _(list).chain().some<{a: number}>({a: 42}); - result = _(dictionary).chain().some(); - result = _(dictionary).chain().some(dictionaryIterator); - result = _(dictionary).chain().some(dictionaryIterator, any); - result = _(dictionary).chain().some(''); + result = _(dictionary).chain().some(); + result = _(dictionary).chain().some(dictionaryIterator); + result = _(dictionary).chain().some('a'); + result = _(dictionary).chain().some(['a', 42]); result = _(dictionary).chain().some<{a: number}>({a: 42}); - result = _(numericDictionary).chain().some(); - result = _(numericDictionary).chain().some(numericDictionaryIterator); - result = _(numericDictionary).chain().some(numericDictionaryIterator, any); - result = _(numericDictionary).chain().some(''); + result = _(numericDictionary).chain().some(); + result = _(numericDictionary).chain().some(numericDictionaryIterator); + result = _(numericDictionary).chain().some('a'); + result = _(numericDictionary).chain().some(['a', 42]); result = _(numericDictionary).chain().some<{a: number}>({a: 42}); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index f01e5afbe..95374e900 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8805,28 +8805,16 @@ declare module _ { //_.some interface LoDashStatic { /** - * Checks if predicate returns truthy for any element of collection. The function returns as soon as it finds - * a passing value and does not iterate over the entire collection. The predicate is bound to thisArg and - * invoked with three arguments: (value, index|key, collection). - * - * If a property name is provided for predicate the created _.property style callback returns the property - * value of the given element. - * - * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for - * elements that have a matching property value, else false. - * - * If an object is provided for predicate the created _.matches style callback returns true for elements that - * have the properties of the given object, else false. + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). * * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. - * @param thisArg The this binding of predicate. * @return Returns true if any element passes the predicate check, else false. */ some( collection: List, - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): boolean; /** @@ -8834,8 +8822,7 @@ declare module _ { */ some( collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any + predicate?: DictionaryIterator ): boolean; /** @@ -8843,8 +8830,7 @@ declare module _ { */ some( collection: NumericDictionary, - predicate?: NumericDictionaryIterator, - thisArg?: any + predicate?: NumericDictionaryIterator ): boolean; /** @@ -8852,8 +8838,7 @@ declare module _ { */ some( collection: List|Dictionary|NumericDictionary, - predicate?: string, - thisArg?: any + predicate?: string|any[] ): boolean; /** @@ -8870,16 +8855,14 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator|NumericDictionaryIterator, - thisArg?: any + predicate?: ListIterator|NumericDictionaryIterator ): boolean; /** * @see _.some */ some( - predicate?: string, - thisArg?: any + predicate?: string|any[] ): boolean; /** @@ -8895,16 +8878,14 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, - thisArg?: any + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator ): boolean; /** * @see _.some */ some( - predicate?: string, - thisArg?: any + predicate?: string|any[] ): boolean; /** @@ -8920,16 +8901,14 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator|NumericDictionaryIterator, - thisArg?: any + predicate?: ListIterator|NumericDictionaryIterator ): LoDashExplicitWrapper; /** * @see _.some */ some( - predicate?: string, - thisArg?: any + predicate?: string|any[] ): LoDashExplicitWrapper; /** @@ -8945,16 +8924,14 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, - thisArg?: any + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator ): LoDashExplicitWrapper; /** * @see _.some */ some( - predicate?: string, - thisArg?: any + predicate?: string|any[] ): LoDashExplicitWrapper; /**