diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 145bb714c7..6b70faea8b 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4205,15 +4205,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 aa4f5d5527..79d6af2913 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10747,6 +10747,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. */ @@ -10760,6 +10761,13 @@ declare module _ { propertyOf(): LoDashImplicitObjectWrapper<(path: string|string[]) => any>; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.propertyOf + */ + propertyOf(): LoDashExplicitObjectWrapper<(path: string|string[]) => any>; + } + //_.range interface LoDashStatic { /**