mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-14 22:10:30 +00:00
Merge pull request #6774 from chrootsu/lodash-has
lodash: signatures of the method _.has have been changed
This commit is contained in:
+28
-8
@@ -6043,14 +6043,34 @@ result = <number>_.get<number>({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c');
|
||||
}
|
||||
|
||||
// _.has
|
||||
result = <boolean>_.has({}, '');
|
||||
result = <boolean>_.has({}, 42);
|
||||
result = <boolean>_.has({}, true);
|
||||
result = <boolean>_.has({}, ['', 42, true]);
|
||||
result = <boolean>_({}).has('');
|
||||
result = <boolean>_({}).has(42);
|
||||
result = <boolean>_({}).has(true);
|
||||
result = <boolean>_({}).has(['', 42, true]);
|
||||
module TestHas {
|
||||
type SampleObject = {a: number; b: string; c: boolean;};
|
||||
|
||||
let object: SampleObject;
|
||||
|
||||
{
|
||||
let result: boolean;
|
||||
|
||||
result = _.has<SampleObject>(object, '');
|
||||
result = _.has<SampleObject>(object, 42);
|
||||
result = _.has<SampleObject>(object, true);
|
||||
result = _.has<SampleObject>(object, ['', 42, true]);
|
||||
|
||||
result = _(object).has('');
|
||||
result = _(object).has(42);
|
||||
result = _(object).has(true);
|
||||
result = _(object).has(['', 42, true]);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<boolean>;
|
||||
|
||||
result = _(object).chain().has('');
|
||||
result = _(object).chain().has(42);
|
||||
result = _(object).chain().has(true);
|
||||
result = _(object).chain().has(['', 42, true]);
|
||||
}
|
||||
}
|
||||
|
||||
// _.invert
|
||||
{
|
||||
|
||||
Vendored
+12
-2
@@ -10596,14 +10596,24 @@ declare module _ {
|
||||
* @param path The path to check.
|
||||
* @return Returns true if path is a direct property, else false.
|
||||
*/
|
||||
has(object: any, path: string|number|boolean|Array<string|number|boolean>): boolean;
|
||||
has<T extends {}>(
|
||||
object: T,
|
||||
path: StringRepresentable|StringRepresentable[]
|
||||
): boolean;
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.has
|
||||
*/
|
||||
has(path: string|number|boolean|Array<string|number|boolean>): boolean;
|
||||
has(path: StringRepresentable|StringRepresentable[]): boolean;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.has
|
||||
*/
|
||||
has(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper<boolean>;
|
||||
}
|
||||
|
||||
//_.invert
|
||||
|
||||
Reference in New Issue
Block a user