diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 85020b5df..b2edfe950 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6116,15 +6116,28 @@ module TestHas { result = _({}).invert(true).value(); } -class Stooge { - constructor( - public name: string, - public age: number - ) { } -} +// _.keys +module TestKeys { + let object: _.Dictionary; -result = _.keys({ 'one': 1, 'two': 2, 'three': 3 }); -result = _({ 'one': 1, 'two': 2, 'three': 3 }).keys().value(); + { + let result: string[]; + + result = _.keys(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).keys(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().keys(); + } +} result = _.keysIn({ 'one': 1, 'two': 2, 'three': 3 }); result = _({ 'one': 1, 'two': 2, 'three': 3 }).keysIn().value(); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e1216dd47..317437062 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10653,18 +10653,26 @@ declare module _ { //_.keys interface LoDashStatic { /** - * Creates an array composed of the own enumerable property names of an object. - * @param object The object to inspect. - * @return An array of property names. - **/ + * Creates an array of the own enumerable property names of object. + * + * @param object The object to query. + * @return Returns the array of property names. + */ keys(object?: any): string[]; } interface LoDashImplicitObjectWrapper { /** - * @see _.keys - **/ - keys(): LoDashImplicitArrayWrapper + * @see _.keys + */ + keys(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.keys + */ + keys(): LoDashExplicitArrayWrapper; } //_.keysIn