From 4b57cabc9f12eb14bc22244873277c7aab9e1378 Mon Sep 17 00:00:00 2001 From: Brian Zengel Date: Sun, 20 Oct 2013 23:26:23 -0400 Subject: [PATCH] added _(...).bind defs --- lodash/lodash-tests.ts | 5 +++-- lodash/lodash.d.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9b2cecdd6..9e5f7b35a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -432,11 +432,12 @@ _.forEach(saves, function(type) { }); var funcBind = 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 funcBind2: () => any = _.bind(funcBind, { 'name': 'moe' }, 'hi'); funcBind2(); +var funcBind3: () => any = _(funcBind).bind({ 'name': 'moe' }, 'hi').value(); +funcBind3(); + var view = { 'label': 'docs', 'onClick': function() { console.log('clicked ' + this.label); } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index d641739fd..278e267bd 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1900,6 +1900,15 @@ declare module _ { thisArg: any, ...args: any[]): () => any; + interface LoDashWrapper { + /** + * @see _.bind + **/ + bind( + thisArg: any, + ...args: any[]): LoDashWrapper<() => any>; + } + /** * Binds methods of an object to the object itself, overwriting the existing method. Method * names may be specified as individual arguments or as arrays of method names. If no method