diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c409e2621..7674eaf6f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4658,22 +4658,31 @@ module TestBackflow { } // _.before -var testBeforeFn = ((n: number) => () => ++n)(0); -var testBeforeResultFn = <() => number>_.before<() => number>(3, testBeforeFn); -result = testBeforeResultFn(); -// → 1 -result = testBeforeResultFn(); -// → 2 -result = testBeforeResultFn(); -// → 2 -var testBeforeFn = ((n: number) => () => ++n)(0); -var testBeforeResultFn = <() => number>_(3).before<() => number>(testBeforeFn); -result = testBeforeResultFn(); -// → 1 -result = testBeforeResultFn(); -// → 2 -result = testBeforeResultFn(); -// → 2 +module TestBefore { + interface Func { + (a: string, b: number): boolean; + } + + let func: Func; + + { + let result: Func; + + _.before(42, func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + _(42).before(func); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + _(42).chain().before(func); + } +} var funcBind = function(greeting: string, punctuation: string) { return greeting + ' ' + this.user + punctuation; }; var funcBound1: (punctuation: string) => any = _.bind(funcBind, { 'name': 'moe' }, 'hi'); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 253107c7f..f7a9a5694 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8048,20 +8048,31 @@ declare module _ { interface LoDashStatic { /** * Creates a function that invokes func, with the this binding and arguments of the created function, while - * it is called less than n times. Subsequent calls to the created function return the result of the last func + * it’s called less than n times. Subsequent calls to the created function return the result of the last func * invocation. + * * @param n The number of calls at which func is no longer invoked. * @param func The function to restrict. * @return Returns the new restricted function. */ - before(n: number, func: TFunc): TFunc; + before( + n: number, + func: TFunc + ): TFunc; } interface LoDashImplicitWrapper { /** - * @sed _.before - */ - before(func: TFunc): TFunc; + * @see _.before + **/ + before(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.before + **/ + before(func: TFunc): LoDashExplicitObjectWrapper; } //_.bind