From c5da0d20a95e69a81f7f5df1b7c1fa343c5f5122 Mon Sep 17 00:00:00 2001 From: Viktoryia Kliushun Date: Thu, 14 Dec 2023 17:11:29 +0100 Subject: [PATCH] Update isEmptyObject typing --- src/types/utils/EmptyObject.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/types/utils/EmptyObject.ts b/src/types/utils/EmptyObject.ts index 8cb1ff6db2a2..aa8b538499cd 100644 --- a/src/types/utils/EmptyObject.ts +++ b/src/types/utils/EmptyObject.ts @@ -2,12 +2,14 @@ import Falsy from './Falsy'; type EmptyObject = Record; +type EmptyValue = EmptyObject | null | undefined; + // eslint-disable-next-line rulesdir/no-negated-variables function isNotEmptyObject | Falsy>(arg: T | EmptyObject): arg is NonNullable { return Object.keys(arg ?? {}).length > 0; } -function isEmptyObject(obj: T | EmptyObject | null | undefined): obj is EmptyObject { +function isEmptyObject(obj: T | EmptyValue): obj is EmptyValue { return Object.keys(obj ?? {}).length === 0; }