diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2ab6480958..ea86b4f0f9 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -393,6 +393,15 @@ _.forEach(saves, function(type) { asyncSave({ 'type': type, 'complete': done }); }); +var func = function (greeting) { return greeting + ' ' + this.name }; +// need a second var otherwise typescript thinks func signature is the above func type, +// instead of the newly returned _bind => func type. +var func2 = _.bind(func, { 'name': 'moe' }, 'hi'); +func2(); + + + + //////////////////////////////////////////////////////////////////////////////////////// @@ -410,11 +419,7 @@ _.forEach(saves, function(type) { /////////////////////////////////////////////////////////////////////////////////////// -var func = function (greeting) { return greeting + ': ' + this.name }; -// need a second var otherwise typescript thinks func signature is the above func type, -// instead of the newly returned _bind => func type. -var func2 = _.bind(func, { name: 'moe' }, 'hi'); -func2(); + var buttonView = { label: 'underscore', diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 35417b1aad..8f8fc694d0 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1706,87 +1706,87 @@ declare module _ { n: number, func: Function): Function; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Bind a function to an object, meaning that whenever the function is called, the value of this will - * be the object. Optionally, bind arguments to the function to pre-fill them, also known as partial application. - * @param func The function to bind `this` to `object`. - * @param context The `this` pointer whenever `fn` is called. - * @param arguments Additional arguments to pass to `fn` when called. - * @return `fn` with `this` bound to `object`. + * Creates a function that, when called, invokes func with the this binding of thisArg + * and prepends any additional bind arguments to those provided to the bound function. + * @param func The function to bind. + * @param thisArg The this binding of func. + * @param args Arguments to be partially applied. + * @return The new bound function. **/ export function bind( func: Function, - context: any, - ...arguments: any[]): () => any; + thisArg: any, + ...args: any[]): () => any; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /** * Binds a number of methods on the object, specified by methodNames, to be run in the context of that object