lodash: signatures of the methods _.prototype.commit, _.prototype.concat and _.now changed

This commit is contained in:
Ilya Mochalov
2015-10-21 14:23:37 +05:00
parent 636876145a
commit f6d417e7dd
2 changed files with 176 additions and 19 deletions
+122 -13
View File
@@ -133,8 +133,6 @@ module TestWrapper {
}
//Wrapped array shortcut methods
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).concat(5, 6);
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).concat([5, 6]);
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);
@@ -1283,17 +1281,111 @@ module TestThru {
}
// _.prototype.commit
{
let result: _.LoDashImplicitWrapper<number>;
result = _(42).commit();
module TestCommit {
{
let result: _.LoDashImplicitWrapper<number>;
result = _(42).commit();
}
{
let result: _.LoDashImplicitArrayWrapper<any>;
result = _<any>([]).commit();
}
{
let result: _.LoDashImplicitObjectWrapper<any>;
result = _({}).commit();
}
{
let result: _.LoDashExplicitWrapper<number>;
result = _(42).chain().commit();
}
{
let result: _.LoDashExplicitArrayWrapper<any>;
result = _<any>([]).chain().commit();
}
{
let result: _.LoDashExplicitObjectWrapper<any>;
result = _({}).chain().commit();
}
}
{
let result: _.LoDashImplicitArrayWrapper<any>;
result = _<any>([]).commit();
}
{
let result: _.LoDashImplicitObjectWrapper<any>;
result = _({}).commit();
// _.prototype.concat
module TestConcat {
{
let result: _.LoDashImplicitArrayWrapper<number>;
result = _(1).concat<number>(2);
result = _(1).concat<number>(2, 3);
result = _(1).concat<number>(2, 3, 4);
result = _(1).concat(2);
result = _(1).concat(2, 3);
result = _(1).concat(2, 3, 4);
}
{
let result: _.LoDashImplicitArrayWrapper<string>;
result = _<string>(['']).concat<string>(['']);
result = _<string>(['']).concat<string>([''], ['']);
result = _<string>(['']).concat<string>([''], [''], ['']);
result = _<string>(['']).concat(['']);
result = _<string>(['']).concat([''], ['']);
result = _<string>(['']).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<number>;
result = _(1).chain().concat<number>(2);
result = _(1).chain().concat<number>(2, 3);
result = _(1).chain().concat<number>(2, 3, 4);
result = _(1).chain().concat(2);
result = _(1).chain().concat(2, 3);
result = _(1).chain().concat(2, 3, 4);
}
{
let result: _.LoDashExplicitArrayWrapper<string>;
result = _<string>(['']).chain().concat<string>(['']);
result = _<string>(['']).chain().concat<string>([''], ['']);
result = _<string>(['']).chain().concat<string>([''], [''], ['']);
result = _<string>(['']).chain().concat(['']);
result = _<string>(['']).chain().concat([''], ['']);
result = _<string>(['']).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 = <IStoogesCombined[]>_(stoogesCombined).where({ 'quotes': ['Poifect!'] }
* Date *
********/
result = <number>_.now();
module TestNow {
{
let result: number;
result = _.now();
result = _(42).now();
result = _<any>([]).now();
result = _({}).now();
}
{
let result: _.LoDashExplicitWrapper<number>;
result = _(42).chain().now();
result = _<any>([]).chain().now();
result = _({}).chain().now();
}
}
/*************
* Functions *
+54 -6
View File
@@ -230,7 +230,6 @@ declare module _ {
interface LoDashExplicitObjectWrapper<T> extends LoDashExplicitWrapperBase<T, LoDashExplicitObjectWrapper<T>> { }
interface LoDashImplicitArrayWrapper<T> extends LoDashImplicitWrapperBase<T[], LoDashImplicitArrayWrapper<T>> {
concat(...items: Array<T|Array<T>>): LoDashImplicitArrayWrapper<T>;
join(seperator?: string): string;
pop(): T;
push(...items: T[]): LoDashImplicitArrayWrapper<T>;
@@ -2469,7 +2468,7 @@ declare module _ {
): LoDashExplicitArrayWrapper<TResult>;
}
// _.prototype.commit
//_.prototype.commit
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* Executes the chained sequence and returns the wrapped result.
@@ -2479,6 +2478,41 @@ declare module _ {
commit(): TWrapper;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.commit
*/
commit(): TWrapper;
}
//_.prototype.concat
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* Creates a new array joining a wrapped array with any additional arrays and/or values.
*
* @param items
* @return Returns the new concatenated array.
*/
concat<TItem>(...items: Array<TItem|Array<TItem>>): LoDashImplicitArrayWrapper<TItem>;
/**
* @see _.concat
*/
concat(...items: Array<T|Array<T>>): LoDashImplicitArrayWrapper<T>;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.concat
*/
concat<TItem>(...items: Array<TItem|Array<TItem>>): LoDashExplicitArrayWrapper<TItem>;
/**
* @see _.concat
*/
concat(...items: Array<T|Array<T>>): LoDashExplicitArrayWrapper<T>;
}
//_.prototype.plant
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
@@ -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<T, TWrapper> {
/**
* @see _.now
*/
now(): number;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.now
*/
now(): LoDashExplicitWrapper<number>;
}
/*************
* Functions *
*************/