mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-30 11:14:27 +08:00
Merge pull request #7272 from chrootsu/lodash-bindAll
lodash: signatures of _.bindAll have been changed
This commit is contained in:
+35
-8
@@ -5027,16 +5027,43 @@ var addTwoNumbers = function (x: number, y: number) { return x + y };
|
||||
var plusTwo = _.bind(addTwoNumbers, null, 2);
|
||||
plusTwo(100);
|
||||
|
||||
var view = {
|
||||
'label': 'docs',
|
||||
'onClick': function () { console.log('clicked ' + this.label); }
|
||||
};
|
||||
// _.bindAll
|
||||
module TestBindAll {
|
||||
interface SampleObject {
|
||||
a: Function;
|
||||
b: Function;
|
||||
c: Function;
|
||||
}
|
||||
|
||||
view = _.bindAll(view);
|
||||
jQuery('#docs').on('click', view.onClick);
|
||||
let object: SampleObject;
|
||||
|
||||
view = _(view).bindAll().value();
|
||||
jQuery('#docs').on('click', view.onClick);
|
||||
{
|
||||
let result: SampleObject;
|
||||
|
||||
result = _.bindAll<SampleObject>(object);
|
||||
result = _.bindAll<SampleObject>(object, 'c');
|
||||
result = _.bindAll<SampleObject>(object, ['b'], 'c');
|
||||
result = _.bindAll<SampleObject>(object, 'a', ['b'], 'c');
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<SampleObject>;
|
||||
|
||||
result = _(object).bindAll();
|
||||
result = _(object).bindAll('c');
|
||||
result = _(object).bindAll(['b'], 'c');
|
||||
result = _(object).bindAll('a', ['b'], 'c');
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<SampleObject>;
|
||||
|
||||
result = _(object).chain().bindAll();
|
||||
result = _(object).chain().bindAll('c');
|
||||
result = _(object).chain().bindAll(['b'], 'c');
|
||||
result = _(object).chain().bindAll('a', ['b'], 'c');
|
||||
}
|
||||
}
|
||||
|
||||
var objectBindKey = {
|
||||
'name': 'moe',
|
||||
|
||||
Vendored
+23
-12
@@ -8588,24 +8588,35 @@ declare module _ {
|
||||
//_.bindAll
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* 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
|
||||
* names are provided all the function properties of object will be bound.
|
||||
* @param object The object to bind and assign the bound methods to.
|
||||
* @param methodNames The object method names to bind, specified as individual method names
|
||||
* or arrays of method names.
|
||||
* @return object
|
||||
**/
|
||||
* 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 names are provided all
|
||||
* enumerable function properties, own and inherited, of object are bound.
|
||||
*
|
||||
* Note: This method does not set the "length" property of bound functions.
|
||||
*
|
||||
* @param object The object to bind and assign the bound methods to.
|
||||
* @param methodNames The object method names to bind, specified as individual method names or arrays of
|
||||
* method names.
|
||||
* @return Returns object.
|
||||
*/
|
||||
bindAll<T>(
|
||||
object: T,
|
||||
...methodNames: string[]): T;
|
||||
...methodNames: (string|string[])[]
|
||||
): T;
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.bindAll
|
||||
**/
|
||||
bindAll(...methodNames: string[]): LoDashImplicitWrapper<T>;
|
||||
* @see _.bindAll
|
||||
*/
|
||||
bindAll(...methodNames: (string|string[])[]): LoDashImplicitObjectWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.bindAll
|
||||
*/
|
||||
bindAll(...methodNames: (string|string[])[]): LoDashExplicitObjectWrapper<T>;
|
||||
}
|
||||
|
||||
//_.bindKey
|
||||
|
||||
Reference in New Issue
Block a user