diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index eb08e7c68..85214a928 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -133,8 +133,6 @@ module TestWrapper { } //Wrapped array shortcut methods -result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).concat(5, 6); -result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).concat([5, 6]); result = _([1, 2, 3, 4]).join(','); result = _([1, 2, 3, 4]).pop(); result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).push(5, 6, 7); @@ -1283,17 +1281,111 @@ module TestThru { } // _.prototype.commit -{ - let result: _.LoDashImplicitWrapper; - result = _(42).commit(); +module TestCommit { + { + let result: _.LoDashImplicitWrapper; + result = _(42).commit(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _([]).commit(); + } + + { + let result: _.LoDashImplicitObjectWrapper; + result = _({}).commit(); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(42).chain().commit(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _([]).chain().commit(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + result = _({}).chain().commit(); + } } -{ - let result: _.LoDashImplicitArrayWrapper; - result = _([]).commit(); -} -{ - let result: _.LoDashImplicitObjectWrapper; - result = _({}).commit(); + +// _.prototype.concat +module TestConcat { + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(1).concat(2); + result = _(1).concat(2, 3); + result = _(1).concat(2, 3, 4); + + result = _(1).concat(2); + result = _(1).concat(2, 3); + result = _(1).concat(2, 3, 4); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(['']).concat(['']); + result = _(['']).concat([''], ['']); + result = _(['']).concat([''], [''], ['']); + + result = _(['']).concat(['']); + result = _(['']).concat([''], ['']); + result = _(['']).concat([''], [''], ['']); + } + + { + let result: _.LoDashImplicitArrayWrapper<{a: string}>; + + result = _({a: ''}).concat<{a: string}>({a: ''}); + result = _({a: ''}).concat<{a: string}>({a: ''}, {a: ''}); + result = _({a: ''}).concat<{a: string}>({a: ''}, {a: ''}, {a: ''}); + + result = _({a: ''}).concat({a: ''}); + result = _({a: ''}).concat({a: ''}, {a: ''}); + result = _({a: ''}).concat({a: ''}, {a: ''}, {a: ''}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(1).chain().concat(2); + result = _(1).chain().concat(2, 3); + result = _(1).chain().concat(2, 3, 4); + + result = _(1).chain().concat(2); + result = _(1).chain().concat(2, 3); + result = _(1).chain().concat(2, 3, 4); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(['']).chain().concat(['']); + result = _(['']).chain().concat([''], ['']); + result = _(['']).chain().concat([''], [''], ['']); + + result = _(['']).chain().concat(['']); + result = _(['']).chain().concat([''], ['']); + result = _(['']).chain().concat([''], [''], ['']); + } + + { + let result: _.LoDashExplicitArrayWrapper<{a: string}>; + + result = _({a: ''}).chain().concat<{a: string}>({a: ''}); + result = _({a: ''}).chain().concat<{a: string}>({a: ''}, {a: ''}); + result = _({a: ''}).chain().concat<{a: string}>({a: ''}, {a: ''}, {a: ''}); + + result = _({a: ''}).chain().concat({a: ''}); + result = _({a: ''}).chain().concat({a: ''}, {a: ''}); + result = _({a: ''}).chain().concat({a: ''}, {a: ''}, {a: ''}); + } } // _.prototype.plant @@ -2057,7 +2149,24 @@ result = _(stoogesCombined).where({ 'quotes': ['Poifect!'] } * Date * ********/ -result = _.now(); +module TestNow { + { + let result: number; + + result = _.now(); + result = _(42).now(); + result = _([]).now(); + result = _({}).now(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(42).chain().now(); + result = _([]).chain().now(); + result = _({}).chain().now(); + } +} /************* * Functions * diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ae2996699..dac4b762c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -230,7 +230,6 @@ declare module _ { interface LoDashExplicitObjectWrapper extends LoDashExplicitWrapperBase> { } interface LoDashImplicitArrayWrapper extends LoDashImplicitWrapperBase> { - concat(...items: Array>): LoDashImplicitArrayWrapper; join(seperator?: string): string; pop(): T; push(...items: T[]): LoDashImplicitArrayWrapper; @@ -2469,7 +2468,7 @@ declare module _ { ): LoDashExplicitArrayWrapper; } - // _.prototype.commit + //_.prototype.commit interface LoDashImplicitWrapperBase { /** * Executes the chained sequence and returns the wrapped result. @@ -2479,6 +2478,41 @@ declare module _ { commit(): TWrapper; } + interface LoDashExplicitWrapperBase { + /** + * @see _.commit + */ + commit(): TWrapper; + } + + //_.prototype.concat + interface LoDashImplicitWrapperBase { + /** + * Creates a new array joining a wrapped array with any additional arrays and/or values. + * + * @param items + * @return Returns the new concatenated array. + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + } + //_.prototype.plant interface LoDashImplicitWrapperBase { /** @@ -5804,13 +5838,27 @@ declare module _ { //_.now interface LoDashStatic { /** - * Gets the number of milliseconds that have elapsed since the Unix epoch - * (1 January 1970 00:00:00 UTC). - * @return The number of milliseconds. - **/ + * Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @return The number of milliseconds. + */ now(): number; } + interface LoDashImplicitWrapperBase { + /** + * @see _.now + */ + now(): number; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.now + */ + now(): LoDashExplicitWrapper; + } + /************* * Functions * *************/