From b93b64bde3370bfcbdf902515b073f57bc598178 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 28 Oct 2015 22:46:34 +0500 Subject: [PATCH] lodash: signatures of the method _.times changed --- lodash/lodash-tests.ts | 59 +++++++++++++++++++++++++++++++----------- lodash/lodash.d.ts | 15 +++++++++++ 2 files changed, 59 insertions(+), 15 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 3afc49041..e8334cdc0 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4406,6 +4406,50 @@ module TestMixin { result = _({}).runInContext(); } +// _.times +module TestTimes { + let iteratee: (num: number) => TResult; + + { + let result: number[]; + + result = _.times(42); + } + + { + let result: TResult[]; + + result = _.times(42, iteratee); + result = _.times(42, iteratee, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(42).times(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(42).times(iteratee); + result = _(42).times(iteratee, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(42).chain().times(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(42).chain().times(iteratee); + result = _(42).chain().times(iteratee, any); + } +} + // _.uniqueId result = _.uniqueId(); result = _.uniqueId(''); @@ -4415,21 +4459,6 @@ result = _.VERSION; result = <_.Support>_.support; result = <_.TemplateSettings>_.templateSettings; -// _.times -{ - let result: number[]; - result = _.times(42); - result = _(42).times().value(); -} -{ - let testTimesFn: (num: number) => TResult; - let result: TResult[]; - result = _.times(42, testTimesFn); - result = _.times(42, testTimesFn, any); - result = _(42).times(testTimesFn).value(); - result = _(42).times(testTimesFn, any).value(); -} - // _.partial & _.partialRight { function func0(): number { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index d143f4e65..9ebdd3f9f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10303,6 +10303,21 @@ declare module _ { times(): LoDashImplicitArrayWrapper; } + interface LoDashExplicitWrapper { + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult, + thisArgs?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.times + */ + times(): LoDashExplicitArrayWrapper; + } + //_.uniqueId interface LoDashStatic { /**