diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 3afc49041b..a7d5b6e16a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3711,15 +3711,34 @@ result = (_('a.b').property().value())(testP result = (_(['a', 'b']).property().value())(testPropertyObject); // _.propertyOf -interface TestPropertyOfObject { - a: { - b: number[]; +module TestPropertyOf { + interface SampleObject { + a: { + b: number[]; + } + } + + let object: SampleObject; + + { + let result: (path: string|string[]) => any; + + result = _.propertyOf({}); + result = _.propertyOf(object); + } + + { + let result: _.LoDashImplicitObjectWrapper<(path: string|string[]) => any>; + + result = _({}).propertyOf(); + } + + { + let result: _.LoDashExplicitObjectWrapper<(path: string|string[]) => any>; + + result = _({}).chain().propertyOf(); } } -var testPropertyOfObject: TestPropertyOfObject; -result = <(path: string|string[]) => any>_.propertyOf({}); -result = <(path: string|string[]) => any>_.propertyOf(testPropertyOfObject); -result = <(path: string|string[]) => any>_({}).propertyOf().value(); // _.range result = _.range(10); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index d143f4e657..758c4e0b1e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10201,6 +10201,7 @@ declare module _ { /** * The opposite of _.property; this method creates a function that returns the property value at a given path * on object. + * * @param object The object to query. * @return Returns the new function. */ @@ -10214,6 +10215,13 @@ declare module _ { propertyOf(): LoDashImplicitObjectWrapper<(path: string|string[]) => any>; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.propertyOf + */ + propertyOf(): LoDashExplicitObjectWrapper<(path: string|string[]) => any>; + } + //_.range interface LoDashStatic { /**