diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 6d66befd7..ae48f5d71 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1529,18 +1529,18 @@ result = <_.LoDashArrayWrapper>_(_).methods(); // _.get result = _.get({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c'); -// → 3 -result = _.get({ 'a': [{ 'b': { 'c': 3 } }] }, ['a', '0', 'b', 'c']); -// → 3 -result = _.get({ 'a': [{ 'b': { 'c': 3 } }] }, 'a.b.c', 'default'); -// → 'default' -result = _({ 'a': [{ 'b': { 'c': 3 } }] }).get('a[0].b.c'); -// → 3 -result = _({ 'a': [{ 'b': { 'c': 3 } }] }).get(['a', '0', 'b', 'c']); -// → 3 -result = _({ 'a': [{ 'b': { 'c': 3 } }] }).get('a.b.c', 'default'); -// → 'default' +{ + let result: TResult; + result = _.get({}, ''); + result = _.get({}, 42); + result = _.get({}, true); + result = _.get({}, ['', 42, true]); + result = _({}).get(''); + result = _({}).get(42); + result = _({}).get(true); + result = _({}).get(['', 42, true]); +} // _.has result = _.has({}, ''); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 7d1e64492..d87de2351 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7153,17 +7153,17 @@ declare module _ { * @param defaultValue The value returned if the resolved value is undefined. * @return Returns the resolved value. **/ - get(object: Object, - path: string|string[], - defaultValue?:T - ): T; + get(object: Object, + path: string|number|boolean|Array, + defaultValue?:TResult + ): TResult; } interface LoDashObjectWrapper { /** * @see _.get **/ - get(path: string|string[], + get(path: string|number|boolean|Array, defaultValue?: TResult ): TResult; }