mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #4276 from arturgorski/master
_.bind updated to support rest parameters
This commit is contained in:
@@ -634,12 +634,16 @@ _.forEach(saves, function (type) {
|
||||
asyncSave({ 'type': type, 'complete': done });
|
||||
});
|
||||
|
||||
var funcBind = function (greeting: string) { return greeting + ' ' + this.name };
|
||||
var funcBind2: () => any = _.bind(funcBind, { 'name': 'moe' }, 'hi');
|
||||
funcBind2();
|
||||
var funcBind = function(greeting: string, punctuation: string) { return greeting + ' ' + this.user + punctuation; };
|
||||
var funcBound1: (punctuation: string) => any = _.bind(funcBind, { 'name': 'moe' }, 'hi');
|
||||
funcBound1('!');
|
||||
|
||||
var funcBind3: () => any = _(funcBind).bind({ 'name': 'moe' }, 'hi').value();
|
||||
funcBind3();
|
||||
var funcBound2: (punctuation: string) => any = _(funcBind).bind({ 'name': 'moe' }, 'hi').value();
|
||||
funcBound2('!');
|
||||
|
||||
var addTwoNumbers = function (x: number, y: number) { return x + y };
|
||||
var plusTwo = _.bind(addTwoNumbers, null, 2);
|
||||
plusTwo(100);
|
||||
|
||||
var view = {
|
||||
'label': 'docs',
|
||||
|
||||
Vendored
+2
-2
@@ -4833,7 +4833,7 @@ declare module _ {
|
||||
bind(
|
||||
func: Function,
|
||||
thisArg: any,
|
||||
...args: any[]): () => any;
|
||||
...args: any[]): (...args: any[]) => any;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
@@ -4842,7 +4842,7 @@ declare module _ {
|
||||
**/
|
||||
bind(
|
||||
thisArg: any,
|
||||
...args: any[]): LoDashObjectWrapper<() => any>;
|
||||
...args: any[]): LoDashObjectWrapper<(...args: any[]) => any>;
|
||||
}
|
||||
|
||||
//_.bindAll
|
||||
|
||||
Reference in New Issue
Block a user