mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Merge pull request #5204 from chrootsu/lodash-restParam
lodash: added _.restParam() method
This commit is contained in:
@@ -973,6 +973,18 @@ var optionsPartialRight = {
|
||||
|
||||
defaultsDeep(optionsPartialRight, _.templateSettings);
|
||||
|
||||
//_.restParam
|
||||
var testRestParamFn = (a: string, b: string, c: number[]) => a + ' ' + b + ' ' + c.join(' ');
|
||||
interface testRestParamFunc {
|
||||
(a: string, b: string, c: number[]): string;
|
||||
}
|
||||
interface testRestParamResult {
|
||||
(a: string, b: string, ...c: number[]): string;
|
||||
}
|
||||
result = <string>(_.restParam<testRestParamResult, testRestParamFunc>(testRestParamFn, 2))('a', 'b', 1, 2, 3);
|
||||
result = <string>(_.restParam<testRestParamResult>(testRestParamFn, 2))('a', 'b', 1, 2, 3);
|
||||
result = <string>(_(testRestParamFn).restParam<testRestParamResult>(2).value())('a', 'b', 1, 2, 3);
|
||||
|
||||
var throttled = _.throttle(function () { }, 100);
|
||||
jQuery(window).on('scroll', throttled);
|
||||
|
||||
|
||||
Vendored
+24
@@ -5634,6 +5634,30 @@ declare module _ {
|
||||
...args: any[]): Function;
|
||||
}
|
||||
|
||||
//_.restParam
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that invokes func with the this binding of the created function and arguments from start
|
||||
* and beyond provided as an array.
|
||||
* @param func The function to apply a rest parameter to.
|
||||
* @param start The start position of the rest parameter.
|
||||
* @return Returns the new function.
|
||||
*/
|
||||
restParam<TResult extends Function>(func: Function, start?: number): TResult;
|
||||
|
||||
/**
|
||||
* @see _.restParam
|
||||
*/
|
||||
restParam<TResult extends Function, TFunc extends Function>(func: TFunc, start?: number): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.restParam
|
||||
*/
|
||||
restParam<TResult extends Function>(start?: number): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.throttle
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user