mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge pull request #7309 from chrootsu/lodash-isArray
lodash: signatures of _.isArray have been changed
This commit is contained in:
@@ -5754,21 +5754,39 @@ result = <boolean>_({}).isArguments();
|
||||
}
|
||||
|
||||
// _.isArray
|
||||
result = <boolean>_.isArray(any);
|
||||
result = <boolean>_(1).isArray();
|
||||
result = <boolean>_<any>([]).isArray();
|
||||
result = <boolean>_({}).isArray();
|
||||
{
|
||||
let value: number[]|string = [1, 3, 5];
|
||||
if (_.isArray(value)) {
|
||||
let length: number[] = value.concat(4);
|
||||
// compile error
|
||||
// let char: string = value.charAt(0);
|
||||
} else {
|
||||
let char: string = value.charAt(0);
|
||||
// compile error
|
||||
// let length: number[] = value.concat(4);
|
||||
}
|
||||
module TestIsArray {
|
||||
{
|
||||
let value: number|string[]|boolean[];
|
||||
|
||||
if (_.isArray<string>(value)) {
|
||||
let result: string[] = value;
|
||||
}
|
||||
else {
|
||||
if (_.isArray<boolean>(value)) {
|
||||
let result: boolean[] = value;
|
||||
}
|
||||
else {
|
||||
let result: number = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
let result: boolean;
|
||||
|
||||
result = _.isArray(any);
|
||||
result = _(1).isArray();
|
||||
result = _<any>([]).isArray();
|
||||
result = _({}).isArray();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<boolean>;
|
||||
|
||||
result = _(1).chain().isArray();
|
||||
result = _<any>([]).chain().isArray();
|
||||
result = _({}).chain().isArray();
|
||||
}
|
||||
}
|
||||
|
||||
// _.isBoolean
|
||||
|
||||
12
lodash/lodash.d.ts
vendored
12
lodash/lodash.d.ts
vendored
@@ -9739,9 +9739,10 @@ declare module _ {
|
||||
/**
|
||||
* Checks if value is classified as an Array object.
|
||||
* @param value The value to check.
|
||||
*
|
||||
* @return Returns true if value is correctly classified, else false.
|
||||
**/
|
||||
isArray(value?: any): value is any[];
|
||||
*/
|
||||
isArray<T>(value?: any): value is T[];
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapperBase<T,TWrapper> {
|
||||
@@ -9751,6 +9752,13 @@ declare module _ {
|
||||
isArray(): boolean;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapperBase<T,TWrapper> {
|
||||
/**
|
||||
* @see _.isArray
|
||||
*/
|
||||
isArray(): LoDashExplicitWrapper<boolean>;
|
||||
}
|
||||
|
||||
//_.isBoolean
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user