mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #6295 from chrootsu/lodash-toArray
lodash: signatures of the method _.toArray have been changed
This commit is contained in:
+41
-6
@@ -1850,12 +1850,6 @@ result = <number[]>_([1, 2, 3]).sortBy(function (num) { return this.sin(num); },
|
||||
result = <string[]>_(['banana', 'strawberry', 'apple']).sortBy('length').value();
|
||||
result = <IFoodOrganic[]>_(foodsOrganic).sortByAll('organic', (food) => food.name, { organic: true }).value();
|
||||
|
||||
(function (a: number, b: number, c: number, d: number): Array<number> { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
|
||||
result = <number[]>_.toArray([1, 2, 3, 4]);
|
||||
(function (a: number, b: number, c: number, d: number): Array<number> { return _(arguments).toArray<number>().slice(1).value(); })(1, 2, 3, 4);
|
||||
result = <number[]>_([1,2,3,4]).toArray().value();
|
||||
|
||||
|
||||
result = <IStoogesCombined[]>_.where(stoogesCombined, { 'age': 40 });
|
||||
result = <IStoogesCombined[]>_.where(stoogesCombined, { 'quotes': ['Poifect!'] });
|
||||
|
||||
@@ -2418,6 +2412,47 @@ result = <boolean>_(1).lte(2);
|
||||
result = <boolean>_([]).lte(2);
|
||||
result = <boolean>_({}).lte(2);
|
||||
|
||||
// _.toArray
|
||||
module TestToArray {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let dictionary: _.Dictionary<TResult>;
|
||||
|
||||
{
|
||||
let result: string[];
|
||||
|
||||
result = _.toArray('');
|
||||
|
||||
result = (function (a: string) {return _.toArray<IArguments, string>(arguments);})('');
|
||||
|
||||
result = _((function (a: string) {return arguments;})('')).toArray<string>().value();
|
||||
}
|
||||
|
||||
{
|
||||
let result: TResult[];
|
||||
|
||||
result = _.toArray<TResult>(array);
|
||||
result = _.toArray<TResult>(list);
|
||||
result = _.toArray<TResult>(dictionary);
|
||||
|
||||
result = _(array).toArray().value();
|
||||
result = _(list).toArray<TResult>().value();
|
||||
result = _(dictionary).toArray<TResult>().value();
|
||||
}
|
||||
|
||||
{
|
||||
let result: any[];
|
||||
|
||||
result = _.toArray();
|
||||
result = _.toArray<number>(42);
|
||||
result = _.toArray<boolean>(true);
|
||||
|
||||
result = _('').toArray<string>().value();
|
||||
result = _(42).toArray<any>().value();
|
||||
result = _(true).toArray<any>().value();
|
||||
}
|
||||
}
|
||||
|
||||
// _.toPlainObject
|
||||
module TestToPlainObject {
|
||||
let result: TResult;
|
||||
|
||||
Vendored
+52
-34
@@ -5649,40 +5649,6 @@ declare module _ {
|
||||
orders?: string[]): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
//_.toArray
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Converts the collection to an array.
|
||||
* @param collection The collection to convert.
|
||||
* @return The new converted array.
|
||||
**/
|
||||
toArray<T>(collection: Array<T>): T[];
|
||||
|
||||
/**
|
||||
* @see _.toArray
|
||||
**/
|
||||
toArray<T>(collection: List<T>): T[];
|
||||
|
||||
/**
|
||||
* @see _.toArray
|
||||
**/
|
||||
toArray<T>(collection: Dictionary<T>): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.toArray
|
||||
**/
|
||||
toArray(): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.toArray
|
||||
**/
|
||||
toArray<TValue>(): LoDashArrayWrapper<TValue>;
|
||||
}
|
||||
|
||||
//_.where
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -7068,6 +7034,58 @@ declare module _ {
|
||||
lte(other: any): boolean;
|
||||
}
|
||||
|
||||
//_.toArray
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Converts value to an array.
|
||||
*
|
||||
* @param value The value to convert.
|
||||
* @return Returns the converted array.
|
||||
*/
|
||||
toArray(value: string): string[];
|
||||
|
||||
/**
|
||||
* @see _.toArray
|
||||
*/
|
||||
toArray<T>(value: List<T>|Dictionary<T>): T[];
|
||||
|
||||
/**
|
||||
* @see _.toArray
|
||||
*/
|
||||
toArray<TValue, TResult>(value: TValue): TResult[];
|
||||
|
||||
/**
|
||||
* @see _.toArray
|
||||
*/
|
||||
toArray<TValue>(value: TValue): any[];
|
||||
|
||||
/**
|
||||
* @see _.toArray
|
||||
*/
|
||||
toArray(value?: any): any[];
|
||||
}
|
||||
|
||||
interface LoDashWrapper<T> {
|
||||
/**
|
||||
* @see _.toArray
|
||||
*/
|
||||
toArray<TResult>(): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.toArray
|
||||
*/
|
||||
toArray(): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.toArray
|
||||
*/
|
||||
toArray<TResult>(): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.toPlainObject
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user