lodash: signatures of the methods _.prototype.plant and _.prototype.reverse changed

This commit is contained in:
Ilya Mochalov
2015-10-21 14:25:34 +05:00
parent f6d417e7dd
commit 4c70fd929c
2 changed files with 129 additions and 24 deletions

View File

@@ -136,7 +136,6 @@ module TestWrapper {
result = <string>_([1, 2, 3, 4]).join(',');
result = <number>_([1, 2, 3, 4]).pop();
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).push(5, 6, 7);
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).reverse();
result = <number>_([1, 2, 3, 4]).shift();
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).sort((a, b) => 1);
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).splice(1);
@@ -1389,29 +1388,79 @@ module TestConcat {
}
// _.prototype.plant
{
let result: _.LoDashImplicitWrapper<number>;
result = _(any).plant(42);
module TestPlant {
{
let result: _.LoDashImplicitWrapper<number>;
result = _(any).plant(42);
}
{
let result: _.LoDashImplicitStringWrapper;
result = _(any).plant('');
}
{
let result: _.LoDashImplicitWrapper<boolean>;
result = _(any).plant(true);
}
{
let result: _.LoDashImplicitNumberArrayWrapper;
result = _(any).plant([42]);
}
{
let result: _.LoDashImplicitArrayWrapper<any>;
result = _(any).plant<any>([]);
}
{
let result: _.LoDashImplicitObjectWrapper<{}>;
result = _(any).plant<{}>({});
}
{
let result: _.LoDashExplicitWrapper<number>;
result = _(any).chain().plant(42);
}
{
let result: _.LoDashExplicitStringWrapper;
result = _(any).chain().plant('');
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(any).chain().plant(true);
}
{
let result: _.LoDashExplicitNumberArrayWrapper;
result = _(any).chain().plant([42]);
}
{
let result: _.LoDashExplicitArrayWrapper<any>;
result = _(any).chain().plant<any>([]);
}
{
let result: _.LoDashExplicitObjectWrapper<{}>;
result = _(any).chain().plant<{}>({});
}
}
{
let result: _.LoDashImplicitStringWrapper;
result = _(any).plant('');
}
{
let result: _.LoDashImplicitWrapper<boolean>;
result = _(any).plant(true);
}
{
let result: _.LoDashImplicitNumberArrayWrapper;
result = _(any).plant([42]);
}
{
let result: _.LoDashImplicitArrayWrapper<any>;
result = _(any).plant<any>([]);
}
{
let result: _.LoDashImplicitObjectWrapper<{}>;
result = _(any).plant<{}>({});
// _.prototype.reverse
module TestReverse {
{
let result: _.LoDashImplicitArrayWrapper<number>;
result: _([42]).reverse();
}
{
let result: _.LoDashExplicitArrayWrapper<number>;
result: _([42]).chain().reverse();
}
}
/**************

58
lodash/lodash.d.ts vendored
View File

@@ -233,7 +233,6 @@ declare module _ {
join(seperator?: string): string;
pop(): T;
push(...items: T[]): LoDashImplicitArrayWrapper<T>;
reverse(): LoDashImplicitArrayWrapper<T>;
shift(): T;
sort(compareFn?: (a: T, b: T) => number): LoDashImplicitArrayWrapper<T>;
splice(start: number): LoDashImplicitArrayWrapper<T>;
@@ -2553,6 +2552,63 @@ declare module _ {
plant(value: any): LoDashImplicitWrapper<any>;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.plant
*/
plant(value: number): LoDashExplicitWrapper<number>;
/**
* @see _.plant
*/
plant(value: string): LoDashExplicitStringWrapper;
/**
* @see _.plant
*/
plant(value: boolean): LoDashExplicitWrapper<boolean>;
/**
* @see _.plant
*/
plant(value: number[]): LoDashExplicitNumberArrayWrapper;
/**
* @see _.plant
*/
plant<T>(value: T[]): LoDashExplicitArrayWrapper<T>;
/**
* @see _.plant
*/
plant<T extends {}>(value: T): LoDashExplicitObjectWrapper<T>;
/**
* @see _.plant
*/
plant(value: any): LoDashExplicitWrapper<any>;
}
//_.prototype.reverse
interface LoDashImplicitArrayWrapper<T> {
/**
* Reverses the wrapped array so the first element becomes the last, the second element becomes the second to
* last, and so on.
*
* Note: This method mutates the wrapped array.
*
* @return Returns the new reversed lodash wrapper instance.
*/
reverse(): LoDashImplicitArrayWrapper<T>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.reverse
*/
reverse(): LoDashExplicitArrayWrapper<T>;
}
// _.run
interface LoDashWrapperBase<T, TWrapper> {
/**