diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 85214a928..c083edd4c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -136,7 +136,6 @@ module TestWrapper { result = _([1, 2, 3, 4]).join(','); result = _([1, 2, 3, 4]).pop(); result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).push(5, 6, 7); -result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).reverse(); result = _([1, 2, 3, 4]).shift(); result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sort((a, b) => 1); result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1); @@ -1389,29 +1388,79 @@ module TestConcat { } // _.prototype.plant -{ - let result: _.LoDashImplicitWrapper; - result = _(any).plant(42); +module TestPlant { + { + let result: _.LoDashImplicitWrapper; + result = _(any).plant(42); + } + + { + let result: _.LoDashImplicitStringWrapper; + result = _(any).plant(''); + } + + { + let result: _.LoDashImplicitWrapper; + result = _(any).plant(true); + } + + { + let result: _.LoDashImplicitNumberArrayWrapper; + result = _(any).plant([42]); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _(any).plant([]); + } + + { + let result: _.LoDashImplicitObjectWrapper<{}>; + result = _(any).plant<{}>({}); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(any).chain().plant(42); + } + + { + let result: _.LoDashExplicitStringWrapper; + result = _(any).chain().plant(''); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(any).chain().plant(true); + } + + { + let result: _.LoDashExplicitNumberArrayWrapper; + result = _(any).chain().plant([42]); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _(any).chain().plant([]); + } + + { + let result: _.LoDashExplicitObjectWrapper<{}>; + result = _(any).chain().plant<{}>({}); + } } -{ - let result: _.LoDashImplicitStringWrapper; - result = _(any).plant(''); -} -{ - let result: _.LoDashImplicitWrapper; - result = _(any).plant(true); -} -{ - let result: _.LoDashImplicitNumberArrayWrapper; - result = _(any).plant([42]); -} -{ - let result: _.LoDashImplicitArrayWrapper; - result = _(any).plant([]); -} -{ - let result: _.LoDashImplicitObjectWrapper<{}>; - result = _(any).plant<{}>({}); + +// _.prototype.reverse +module TestReverse { + { + let result: _.LoDashImplicitArrayWrapper; + result: _([42]).reverse(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result: _([42]).chain().reverse(); + } } /************** diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index dac4b762c..881124328 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -233,7 +233,6 @@ declare module _ { join(seperator?: string): string; pop(): T; push(...items: T[]): LoDashImplicitArrayWrapper; - reverse(): LoDashImplicitArrayWrapper; shift(): T; sort(compareFn?: (a: T, b: T) => number): LoDashImplicitArrayWrapper; splice(start: number): LoDashImplicitArrayWrapper; @@ -2553,6 +2552,63 @@ declare module _ { plant(value: any): LoDashImplicitWrapper; } + interface LoDashExplicitWrapperBase { + /** + * @see _.plant + */ + plant(value: number): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: string): LoDashExplicitStringWrapper; + + /** + * @see _.plant + */ + plant(value: boolean): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: number[]): LoDashExplicitNumberArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T[]): LoDashExplicitArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T): LoDashExplicitObjectWrapper; + + /** + * @see _.plant + */ + plant(value: any): LoDashExplicitWrapper; + } + + //_.prototype.reverse + interface LoDashImplicitArrayWrapper { + /** + * 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; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.reverse + */ + reverse(): LoDashExplicitArrayWrapper; + } + // _.run interface LoDashWrapperBase { /**