diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5c52443587..883cfb1bbc 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9953,6 +9953,29 @@ module TestNoop { } } +namespace TestNthArg { + type SampleFunc = (...args: any[]) => any; + + { + let result: SampleFunc; + + result = _.nthArg(); + result = _.nthArg(1); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(1).nthArg(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(1).chain().nthArg(); + } +} + // _.over namespace TestOver { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6e884fc9b..bbd742cb69 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -16308,6 +16308,31 @@ declare module _ { noop(...args: any[]): _.LoDashExplicitWrapper; } + //_.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(n?: number): TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.nthArg + */ + nthArg(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.nthArg + */ + nthArg(): LoDashExplicitObjectWrapper; + } + //_.over interface LoDashStatic { /**