diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f810a9ebb..fe08656c1 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3696,8 +3696,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 000fc6895..c9b56c1e6 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7510,10 +7510,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; } @@ -7524,6 +7524,13 @@ declare module _ { once(): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.once + */ + once(): LoDashExplicitObjectWrapper; + } + //_.partial interface LoDashStatic { /**