diff --git a/src/decorator/typechecker/IsObject.ts b/src/decorator/typechecker/IsObject.ts index 5cbd415b67..882c012313 100644 --- a/src/decorator/typechecker/IsObject.ts +++ b/src/decorator/typechecker/IsObject.ts @@ -8,7 +8,7 @@ export const IS_OBJECT = 'isObject'; * Returns false if the value is not an object. */ export function isObject(value: unknown): value is T { - return value != null && (typeof value === 'object' || typeof value === 'function') && !Array.isArray(value); + return value != null && typeof value === 'object' && !Array.isArray(value); } /** diff --git a/test/functional/validation-functions-and-decorators.spec.ts b/test/functional/validation-functions-and-decorators.spec.ts index 4c266f02ee..97f2197cbb 100644 --- a/test/functional/validation-functions-and-decorators.spec.ts +++ b/test/functional/validation-functions-and-decorators.spec.ts @@ -3166,6 +3166,10 @@ describe('IsObject', () => { '[]', [], [{ key: 'value' }], + () => 'function', + function namedFn() { + return 'named function'; + }, ]; class MyClass {