diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7dd2249c9d..f5a2f027bf 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -2403,18 +2403,23 @@ result = _([]).lte(2); result = _({}).lte(2); // _.toPlainObject -result = _.toPlainObject(); -result = _.toPlainObject(true); -result = _.toPlainObject(1); -result = _.toPlainObject('a'); -result = _.toPlainObject([]); -result = _.toPlainObject({}); -result = _(true).toPlainObject(); -result = _(1).toPlainObject(); -result = _('a').toPlainObject(); -result = _([1]).toPlainObject(); -result = _([]).toPlainObject(); -result = _({}).toPlainObject(); +module TestToPlainObject { + let result: TResult; + + result = _.toPlainObject(); + result = _.toPlainObject(true); + result = _.toPlainObject(1); + result = _.toPlainObject('a'); + result = _.toPlainObject([]); + result = _.toPlainObject({}); + + result = _(true).toPlainObject().value(); + result = _(1).toPlainObject().value(); + result = _('a').toPlainObject().value(); + result = _([1]).toPlainObject().value(); + result = _([]).toPlainObject().value(); + result = _({}).toPlainObject().value(); +} /******** * Math * diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 60aaf60b71..f0ee866796 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -238,11 +238,6 @@ declare module _ { * @see _.value **/ valueOf(): T; - - /** - * @see _.toPlainObject - */ - toPlainObject(): Object; } interface LoDashWrapper extends LoDashWrapperBase> { } @@ -7180,10 +7175,18 @@ declare module _ { /** * Converts value to a plain object flattening inherited enumerable properties of value to own properties * of the plain object. + * * @param value The value to convert. * @return Returns the converted plain object. */ - toPlainObject(value?: any): Object; + toPlainObject(value?: any): TResult; + } + + interface LoDashWrapperBase { + /** + * @see _.toPlainObject + */ + toPlainObject(): LoDashObjectWrapper; } /********