diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ef5b46c63b..9e3e9ada6d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9379,6 +9379,34 @@ module TestTransform { } } +// _.unset +namespace TestUnset { + type SampleObject = {a: {b: string; c: boolean}}; + + let object: SampleObject; + + { + let result: boolean; + + _.unset(object, 'a.b'); + _.unset(object, ['a', 'b']); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(object).unset('a.b'); + result = _(object).unset(['a', 'b']); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(object).chain().unset('a.b'); + result = _(object).chain().unset(['a', 'b']); + } +} + // _.values module TestValues { let object: _.Dictionary; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9163c66741..7ddc02dcae 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5295,21 +5295,6 @@ declare module _ { ): any[]; } - //_.unset - interface LoDashStatic { - /** - * Removes the property at path of object. - * - * @param object The object to modify. - * @param path The path of the property to unset. - * @return Returns true if the property is deleted, else false. - */ - unset( - object: T, - path: StringRepresentable | StringRepresentable[] - ): boolean; - } - //_.unzip interface LoDashStatic { /** @@ -15922,6 +15907,37 @@ declare module _ { ): LoDashImplicitArrayWrapper; } + //_.unset + interface LoDashStatic { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + unset( + object: T, + path: StringRepresentable|StringRepresentable[] + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.unset + */ + unset(path: StringRepresentable|StringRepresentable[]): LoDashImplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.unset + */ + unset(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper; + } + //_.values interface LoDashStatic { /**