From b93e5ce63b563521df276d63437b73c917fd1469 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 15 Nov 2015 10:57:42 +0500 Subject: [PATCH] lodash: signatures of the method _.has have been changed --- lodash/lodash-tests.ts | 36 ++++++++++++++++++++++++++++-------- lodash/lodash.d.ts | 14 ++++++++++++-- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 4c587b57b5..85965449a5 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5319,14 +5319,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 98d8bf55d9..ec2141cc5c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10128,14 +10128,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