lodash: signatures of the method _.map changed

This commit is contained in:
Ilya Mochalov
2015-11-02 19:28:31 +05:00
parent 4b6b5a1352
commit b62510edc6
2 changed files with 217 additions and 71 deletions
+117 -35
View File
@@ -1858,43 +1858,89 @@ module TestCollect {
let array: number[];
let list: _.List<number>;
let dictionary: _.Dictionary<number>;
let listIterator: {(value: number, index: number, collection: _.List<number>): TResult};
let dictionaryIterator: {(value: number, key: string, collection: _.Dictionary<number>): TResult};
let listIterator: (value: number, index: number, collection: _.List<number>) => TResult;
let dictionaryIterator: (value: number, key: string, collection: _.Dictionary<number>) => TResult;
{
let result: TResult[];
result = _.collect<number, TResult>(array);
result = _.collect<number, TResult>(array, listIterator);
result = _.collect<number, TResult>(array, listIterator, any);
result = _.collect<number, TResult>(array, '');
result = _.collect<number, TResult>(list);
result = _.collect<number, TResult>(list, listIterator);
result = _.collect<number, TResult>(list, listIterator, any);
result = _.collect<number, TResult>(list, '');
result = _.collect<number, TResult>(dictionary);
result = _.collect<number, TResult>(dictionary, dictionaryIterator);
result = _.collect<number, TResult>(dictionary, dictionaryIterator, any);
result = _.collect<number, TResult>(dictionary, '');
result = _<number>(array).collect<TResult>().value();
result = _<number>(array).collect<TResult>(listIterator).value();
result = _<number>(array).collect<TResult>(listIterator, any).value();
result = _<number>(array).collect<TResult>('').value();
result = _(list).collect<number, TResult>().value();
result = _(list).collect<number, TResult>(listIterator).value();
result = _(list).collect<number, TResult>(listIterator, any).value();
result = _(list).collect<number, TResult>('').value();
result = _(dictionary).collect<number, TResult>().value();
result = _(dictionary).collect<number, TResult>(dictionaryIterator).value();
result = _(dictionary).collect<number, TResult>(dictionaryIterator, any).value();
result = _(dictionary).collect<number, TResult>('').value();
}
{
let result: boolean[];
result = _.collect<number, {}>(array, {});
result = _.collect<number, {}>(list, {});
result = _.collect<number, {}>(dictionary, {});
result = _<number>(array).collect<{}>({}).value();
result = _(list).collect<{}>({}).value();
result = _(dictionary).collect<{}>({}).value();
}
{
let result: _.LoDashImplicitArrayWrapper<TResult>;
result = _<number>(array).collect<TResult>();
result = _<number>(array).collect<TResult>(listIterator);
result = _<number>(array).collect<TResult>(listIterator, any);
result = _<number>(array).collect<TResult>('');
result = _(list).collect<number, TResult>();
result = _(list).collect<number, TResult>(listIterator);
result = _(list).collect<number, TResult>(listIterator, any);
result = _(list).collect<number, TResult>('');
result = _(dictionary).collect<number, TResult>();
result = _(dictionary).collect<number, TResult>(dictionaryIterator);
result = _(dictionary).collect<number, TResult>(dictionaryIterator, any);
result = _(dictionary).collect<number, TResult>('');
}
{
let result: _.LoDashImplicitArrayWrapper<boolean>;
result = _<number>(array).collect<{}>({});
result = _(list).collect<{}>({});
result = _(dictionary).collect<{}>({});
}
{
let result: _.LoDashExplicitArrayWrapper<TResult>;
result = _<number>(array).chain().collect<TResult>();
result = _<number>(array).chain().collect<TResult>(listIterator);
result = _<number>(array).chain().collect<TResult>(listIterator, any);
result = _<number>(array).chain().collect<TResult>('');
result = _(list).chain().collect<number, TResult>();
result = _(list).chain().collect<number, TResult>(listIterator);
result = _(list).chain().collect<number, TResult>(listIterator, any);
result = _(list).chain().collect<number, TResult>('');
result = _(dictionary).chain().collect<number, TResult>();
result = _(dictionary).chain().collect<number, TResult>(dictionaryIterator);
result = _(dictionary).chain().collect<number, TResult>(dictionaryIterator, any);
result = _(dictionary).chain().collect<number, TResult>('');
}
{
let result: _.LoDashExplicitArrayWrapper<boolean>;
result = _<number>(array).chain().collect<{}>({});
result = _(list).chain().collect<{}>({});
result = _(dictionary).chain().collect<{}>({});
}
}
@@ -2214,32 +2260,68 @@ module TestMap {
result = _.map<number, TResult>(dictionary, dictionaryIterator);
result = _.map<number, TResult>(dictionary, dictionaryIterator, any);
result = _.map<number, TResult>(dictionary, '');
result = _<number>(array).map<TResult>().value();
result = _<number>(array).map<TResult>(listIterator).value();
result = _<number>(array).map<TResult>(listIterator, any).value();
result = _<number>(array).map<TResult>('').value();
result = _(list).map<number, TResult>().value();
result = _(list).map<number, TResult>(listIterator).value();
result = _(list).map<number, TResult>(listIterator, any).value();
result = _(list).map<number, TResult>('').value();
result = _(dictionary).map<number, TResult>().value();
result = _(dictionary).map<number, TResult>(dictionaryIterator).value();
result = _(dictionary).map<number, TResult>(dictionaryIterator, any).value();
result = _(dictionary).map<number, TResult>('').value();
}
{
let result: boolean[];
result = _.map<number, {}>(array, {});
result = _.map<number, {}>(list, {});
result = _.map<number, {}>(dictionary, {});
}
result = _<number>(array).map<{}>({}).value();
result = _(list).map<{}>({}).value();
result = _(dictionary).map<{}>({}).value();
{
let result: _.LoDashImplicitArrayWrapper<TResult>;
result = _<number>(array).map<TResult>();
result = _<number>(array).map<TResult>(listIterator);
result = _<number>(array).map<TResult>(listIterator, any);
result = _<number>(array).map<TResult>('');
result = _(list).map<number, TResult>();
result = _(list).map<number, TResult>(listIterator);
result = _(list).map<number, TResult>(listIterator, any);
result = _(list).map<number, TResult>('');
result = _(dictionary).map<number, TResult>();
result = _(dictionary).map<number, TResult>(dictionaryIterator);
result = _(dictionary).map<number, TResult>(dictionaryIterator, any);
result = _(dictionary).map<number, TResult>('');
}
{
let result: _.LoDashImplicitArrayWrapper<boolean>;
result = _<number>(array).map<{}>({});
result = _(list).map<{}>({});
result = _(dictionary).map<{}>({});
}
{
let result: _.LoDashExplicitArrayWrapper<TResult>;
result = _<number>(array).chain().map<TResult>();
result = _<number>(array).chain().map<TResult>(listIterator);
result = _<number>(array).chain().map<TResult>(listIterator, any);
result = _<number>(array).chain().map<TResult>('');
result = _(list).chain().map<number, TResult>();
result = _(list).chain().map<number, TResult>(listIterator);
result = _(list).chain().map<number, TResult>(listIterator, any);
result = _(list).chain().map<number, TResult>('');
result = _(dictionary).chain().map<number, TResult>();
result = _(dictionary).chain().map<number, TResult>(dictionaryIterator);
result = _(dictionary).chain().map<number, TResult>(dictionaryIterator, any);
result = _(dictionary).chain().map<number, TResult>('');
}
{
let result: _.LoDashExplicitArrayWrapper<boolean>;
result = _<number>(array).chain().map<{}>({});
result = _(list).chain().map<{}>({});
result = _(dictionary).chain().map<{}>({});
}
}
+100 -36
View File
@@ -3031,15 +3031,7 @@ declare module _ {
* @see _.map
*/
collect<T, TResult>(
collection: List<T>,
iteratee?: string
): TResult[];
/**
* @see _.map
*/
collect<T, TResult>(
collection: Dictionary<T>,
collection: List<T>|Dictionary<T>,
iteratee?: string
): TResult[];
@@ -3047,15 +3039,7 @@ declare module _ {
* @see _.map
*/
collect<T, TObject extends {}>(
collection: List<T>,
iteratee?: TObject
): boolean[];
/**
* @see _.map
*/
collect<T, TObject extends {}>(
collection: Dictionary<T>,
collection: List<T>|Dictionary<T>,
iteratee?: TObject
): boolean[];
}
@@ -3108,6 +3092,54 @@ declare module _ {
): LoDashImplicitArrayWrapper<boolean>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.map
*/
collect<TResult>(
iteratee?: ListIterator<T, TResult>,
thisArg?: any
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.map
*/
collect<TResult>(
iteratee?: string
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.map
*/
collect<TObject extends {}>(
iteratee?: TObject
): LoDashExplicitArrayWrapper<boolean>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.map
*/
collect<TValue, TResult>(
iteratee?: ListIterator<TValue, TResult>|DictionaryIterator<TValue, TResult>,
thisArg?: any
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.map
*/
collect<TValue, TResult>(
iteratee?: string
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.map
*/
collect<TObject extends {}>(
iteratee?: TObject
): LoDashExplicitArrayWrapper<boolean>;
}
//_.contains
interface LoDashStatic {
/**
@@ -4653,15 +4685,7 @@ declare module _ {
* @see _.map
*/
map<T, TResult>(
collection: List<T>,
iteratee?: string
): TResult[];
/**
* @see _.map
*/
map<T, TResult>(
collection: Dictionary<T>,
collection: List<T>|Dictionary<T>,
iteratee?: string
): TResult[];
@@ -4669,15 +4693,7 @@ declare module _ {
* @see _.map
*/
map<T, TObject extends {}>(
collection: List<T>,
iteratee?: TObject
): boolean[];
/**
* @see _.map
*/
map<T, TObject extends {}>(
collection: Dictionary<T>,
collection: List<T>|Dictionary<T>,
iteratee?: TObject
): boolean[];
}
@@ -4730,6 +4746,54 @@ declare module _ {
): LoDashImplicitArrayWrapper<boolean>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.map
*/
map<TResult>(
iteratee?: ListIterator<T, TResult>,
thisArg?: any
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.map
*/
map<TResult>(
iteratee?: string
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.map
*/
map<TObject extends {}>(
iteratee?: TObject
): LoDashExplicitArrayWrapper<boolean>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.map
*/
map<TValue, TResult>(
iteratee?: ListIterator<TValue, TResult>|DictionaryIterator<TValue, TResult>,
thisArg?: any
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.map
*/
map<TValue, TResult>(
iteratee?: string
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.map
*/
map<TObject extends {}>(
iteratee?: TObject
): LoDashExplicitArrayWrapper<boolean>;
}
//_.pluck
interface LoDashStatic {
/**