From 51f1a0a6271989b76a09bc5301e8397526ee0a06 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 7 Nov 2015 12:48:44 +0500 Subject: [PATCH] lodash: signatures of the method _.takeWhile have been changed --- lodash/lodash-tests.ts | 75 ++++++++++++++++++++++++++++-------------- lodash/lodash.d.ts | 50 ++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 25 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 876547fd6..7951c6b6d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1231,35 +1231,60 @@ module TestTakeWhile { let array: TResult[]; let list: _.List; let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; - let result: TResult[]; - result = _.takeWhile(array); - result = _.takeWhile(array, predicateFn); - result = _.takeWhile(array, predicateFn, any); - result = _.takeWhile(array, ''); - result = _.takeWhile(array, '', any); - result = _.takeWhile<{a: number;}, TResult>(array, {a: 42}); + { + let result: TResult[]; - result = _.takeWhile(list); - result = _.takeWhile(list, predicateFn); - result = _.takeWhile(list, predicateFn, any); - result = _.takeWhile(list, ''); - result = _.takeWhile(list, '', any); - result = _.takeWhile<{a: number;}, TResult>(list, {a: 42}); + result = _.takeWhile(array); + result = _.takeWhile(array, predicateFn); + result = _.takeWhile(array, predicateFn, any); + result = _.takeWhile(array, ''); + result = _.takeWhile(array, '', any); + result = _.takeWhile<{a: number;}, TResult>(array, {a: 42}); - result = _(array).takeWhile().value(); - result = _(array).takeWhile(predicateFn).value(); - result = _(array).takeWhile(predicateFn, any).value(); - result = _(array).takeWhile('').value(); - result = _(array).takeWhile('', any).value(); - result = _(array).takeWhile<{a: number;}>({a: 42}).value(); + result = _.takeWhile(list); + result = _.takeWhile(list, predicateFn); + result = _.takeWhile(list, predicateFn, any); + result = _.takeWhile(list, ''); + result = _.takeWhile(list, '', any); + result = _.takeWhile<{a: number;}, TResult>(list, {a: 42}); + } - result = _(list).takeWhile().value(); - result = _(list).takeWhile(predicateFn).value(); - result = _(list).takeWhile(predicateFn, any).value(); - result = _(list).takeWhile('').value(); - result = _(list).takeWhile('', any).value(); - result = _(list).takeWhile<{a: number;}, TResult>({a: 42}).value(); + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).takeWhile(); + result = _(array).takeWhile(predicateFn); + result = _(array).takeWhile(predicateFn, any); + result = _(array).takeWhile(''); + result = _(array).takeWhile('', any); + result = _(array).takeWhile<{a: number;}>({a: 42}); + + result = _(list).takeWhile(); + result = _(list).takeWhile(predicateFn); + result = _(list).takeWhile(predicateFn, any); + result = _(list).takeWhile(''); + result = _(list).takeWhile('', any); + result = _(list).takeWhile<{a: number;}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().takeWhile(); + result = _(array).chain().takeWhile(predicateFn); + result = _(array).chain().takeWhile(predicateFn, any); + result = _(array).chain().takeWhile(''); + result = _(array).chain().takeWhile('', any); + result = _(array).chain().takeWhile<{a: number;}>({a: 42}); + + result = _(list).chain().takeWhile(); + result = _(list).chain().takeWhile(predicateFn); + result = _(list).chain().takeWhile(predicateFn, any); + result = _(list).chain().takeWhile(''); + result = _(list).chain().takeWhile('', any); + result = _(list).chain().takeWhile<{a: number;}, TResult>({a: 42}); + } } // _.union diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 359cc0fb9..3f72b7e1f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2251,6 +2251,56 @@ declare module _ { ): LoDashImplicitArrayWrapper; } + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + //_.union interface LoDashStatic { /**