mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
added _(...).bind defs
This commit is contained in:
@@ -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); }
|
||||
|
||||
Vendored
+9
@@ -1900,6 +1900,15 @@ declare module _ {
|
||||
thisArg: any,
|
||||
...args: any[]): () => any;
|
||||
|
||||
interface LoDashWrapper<T> {
|
||||
/**
|
||||
* @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
|
||||
|
||||
Reference in New Issue
Block a user