diff --git a/types/lodash/common/lang.d.ts b/types/lodash/common/lang.d.ts index 723388c9cc..14b00747a0 100644 --- a/types/lodash/common/lang.d.ts +++ b/types/lodash/common/lang.d.ts @@ -1224,14 +1224,14 @@ declare module "../index" { * @param value The value to check. * @return Returns true if value is an object, else false. */ - isObject(value?: any): boolean; + isObject(value?: any): value is object; } interface LoDashImplicitWrapper { /** * see _.isObject */ - isObject(): boolean; + isObject(): this is LoDashImplicitWrapper; } interface LoDashExplicitWrapper { diff --git a/types/lodash/fp.d.ts b/types/lodash/fp.d.ts index c26cedeb10..023758b4c3 100644 --- a/types/lodash/fp.d.ts +++ b/types/lodash/fp.d.ts @@ -1984,7 +1984,7 @@ declare namespace _ { type LodashIsNil = (value: any) => value is null | undefined; type LodashIsNull = (value: any) => value is null; type LodashIsNumber = (value: any) => value is number; - type LodashIsObject = (value: any) => boolean; + type LodashIsObject = (value: any) => value is object; type LodashIsObjectLike = (value: any) => boolean; type LodashIsPlainObject = (value: any) => boolean; type LodashIsRegExp = (value: any) => value is RegExp; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 4f3c0f363c..3dcb7bbeea 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -4291,6 +4291,12 @@ fp.now(); // $ExpectType number _(42).isObject(); // $ExpectType boolean _.chain([]).isObject(); // $ExpectType LoDashExplicitWrapper fp.isObject(anything); // $ExpectType boolean + if (fp.isObject(anything)) { + anything; // $ExpectType object + } + if (_.isObject(anything)) { + anything; // $ExpectType object + } } // _.isObjectLike