Merge pull request #7818 from chrootsu/lodash-nthArg

lodash: _.nthArg added
This commit is contained in:
Masahiro Wakame 2016-01-29 12:44:47 +09:00
commit 2bbc03a4e4
2 changed files with 48 additions and 0 deletions

View File

@ -9953,6 +9953,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
lodash/lodash.d.ts vendored
View File

@ -16308,6 +16308,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 {
/**