diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 8b3aa0c97..45248b829 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1650,8 +1650,6 @@ var testAttempFn: TestAttemptFn; result = _.attempt(testAttempFn); result = _(testAttempFn).attempt(); -result = <{ name: string }>_.identity({ 'name': 'moe' }); - _.mixin({ 'capitalize': function (string) { return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); @@ -1907,6 +1905,22 @@ result = <() => boolean>_(true).constant(); result = <() => any[]>_(['a']).constant(); result = <() => {}>_({}).constant<{}>(); +// _.identity +{ + let testIdentityValue: TResult; + let result: TResult; + result = _.identity(testIdentityValue); + result = _(testIdentityValue).identity(); +} +{ + let result: number; + result = _(42).identity(); +} +{ + let result: boolean[]; + result = _([]).identity(); +} + // _.method class TestMethod { a = { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 6dee2a337..92b621ab2 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8055,13 +8055,34 @@ declare module _ { //_.identity interface LoDashStatic { /** - * This method returns the first argument provided to it. - * @param value Any value. - * @return value. - **/ + * This method returns the first argument provided to it. + * @param value Any value. + * @return Returns value. + */ identity(value?: T): T; } + interface LoDashWrapper { + /** + * @see _.identity + */ + identity(): T; + } + + interface LoDashArrayWrapper { + /** + * @see _.identity + */ + identity(): T[]; + } + + interface LoDashObjectWrapper { + /** + * @see _.identity + */ + identity(): T; + } + //_.method interface LoDashStatic { /**