From f8f1b6e06788ec8f344e8ded099c543ce9649df6 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 8 Nov 2015 19:22:56 +0500 Subject: [PATCH] lodash: signatures of the method _.once have been changed --- lodash/lodash-tests.ts | 27 +++++++++++++++++++++++++-- lodash/lodash.d.ts | 9 ++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 876547fd6..63abc1839 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3501,8 +3501,31 @@ result = _(testNegatePredicate).negate().value(); result = _(testNegatePredicate).negate().value(); // _.once -result = <() => void>_.once<() => void>(function () {}); -result = <() => void>(_(function () {}).once().value()); +module TestOnce { + interface Func { + (a: number, b: string): boolean; + } + + let func: Func; + + { + let result: Func; + + result = _.once(func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).once(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().once(); + } +} var returnedOnce = _.throttle(function (a: any) { return a * 5; }, 5); returnedOnce(4); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 359cc0fb9..9abc16c71 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7376,10 +7376,10 @@ declare module _ { /** * Creates a function that is restricted to invoking func once. Repeat calls to the function return the value * of the first call. The func is invoked with the this binding and arguments of the created function. + * * @param func The function to restrict. * @return Returns the new restricted function. */ - once(func: T): T; } @@ -7390,6 +7390,13 @@ declare module _ { once(): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.once + */ + once(): LoDashExplicitObjectWrapper; + } + //_.partial interface LoDashStatic { /**