Merge pull request #6555 from chrootsu/lodash-take

lodash: signatures of the method _.take changed
This commit is contained in:
Masahiro Wakame
2015-11-02 23:39:24 +09:00
2 changed files with 44 additions and 9 deletions
+30 -9
View File
@@ -970,15 +970,36 @@ module TestTail {
module TestTake {
let array: TResult[];
let list: _.List<TResult>;
let result: TResult[];
result = _.take<TResult>(array);
result = _.take<TResult>(array, 42);
result = _.take<TResult>(list);
result = _.take<TResult>(list, 42);
result = _(array).take().value();
result = _(array).take(42).value();
result = _(list).take<TResult>().value();
result = _(list).take<TResult>(42).value();
{
let result: TResult[];
result = _.take<TResult>(array);
result = _.take<TResult>(array, 42);
result = _.take<TResult>(list);
result = _.take<TResult>(list, 42);
}
{
let result: _.LoDashImplicitArrayWrapper<TResult>;
result = _(array).take();
result = _(array).take(42);
result = _(list).take<TResult>();
result = _(list).take<TResult>(42);
}
{
let result: _.LoDashExplicitArrayWrapper<TResult>;
result = _(array).chain().take();
result = _(array).chain().take(42);
result = _(list).chain().take<TResult>();
result = _(list).chain().take<TResult>(42);
}
}
// _.takeRight
+14
View File
@@ -1730,6 +1730,20 @@ declare module _ {
take<TResult>(n?: number): LoDashImplicitArrayWrapper<TResult>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.take
*/
take(n?: number): LoDashExplicitArrayWrapper<T>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.take
*/
take<TResult>(n?: number): LoDashExplicitArrayWrapper<TResult>;
}
//_.takeRight
interface LoDashStatic {
/**