diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 97750df479..888adc8d85 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6043,14 +6043,34 @@ result = _.get({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c'); } // _.has -result = _.has({}, ''); -result = _.has({}, 42); -result = _.has({}, true); -result = _.has({}, ['', 42, true]); -result = _({}).has(''); -result = _({}).has(42); -result = _({}).has(true); -result = _({}).has(['', 42, true]); +module TestHas { + type SampleObject = {a: number; b: string; c: boolean;}; + + let object: SampleObject; + + { + let result: boolean; + + result = _.has(object, ''); + result = _.has(object, 42); + result = _.has(object, true); + result = _.has(object, ['', 42, true]); + + result = _(object).has(''); + result = _(object).has(42); + result = _(object).has(true); + result = _(object).has(['', 42, true]); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(object).chain().has(''); + result = _(object).chain().has(42); + result = _(object).chain().has(true); + result = _(object).chain().has(['', 42, true]); + } +} // _.invert { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index bd18e27a76..aec91d274e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -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): boolean; + has( + object: T, + path: StringRepresentable|StringRepresentable[] + ): boolean; } interface LoDashImplicitObjectWrapper { /** * @see _.has */ - has(path: string|number|boolean|Array): boolean; + has(path: StringRepresentable|StringRepresentable[]): boolean; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.has + */ + has(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper; } //_.invert