lodash: _.nthArg added

This commit is contained in:
Ilya Mochalov
2016-01-27 10:56:17 +05:00
parent f29bf726a6
commit 251aea1323
2 changed files with 48 additions and 0 deletions
+23
View File
@@ -9881,6 +9881,29 @@ module TestNoop {
}
}
namespace TestNthArg {
type SampleFunc = (...args: any[]) => any;
{
let result: SampleFunc;
result = _.nthArg<SampleFunc>();
result = _.nthArg<SampleFunc>(1);
}
{
let result: _.LoDashImplicitObjectWrapper<SampleFunc>;
result = _(1).nthArg<SampleFunc>();
}
{
let result: _.LoDashExplicitObjectWrapper<SampleFunc>;
result = _(1).chain().nthArg<SampleFunc>();
}
}
// _.over
namespace TestOver {
{
+25
View File
@@ -16195,6 +16195,31 @@ declare module _ {
noop(...args: any[]): _.LoDashExplicitWrapper<void>;
}
//_.nthArg
interface LoDashStatic {
/**
* Creates a function that returns its nth argument.
*
* @param n The index of the argument to return.
* @return Returns the new function.
*/
nthArg<TResult extends Function>(n?: number): TResult;
}
interface LoDashImplicitWrapper<T> {
/**
* @see _.nthArg
*/
nthArg<TResult extends Function>(): LoDashImplicitObjectWrapper<TResult>;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.nthArg
*/
nthArg<TResult extends Function>(): LoDashExplicitObjectWrapper<TResult>;
}
//_.over
interface LoDashStatic {
/**