From a69e559890d888d10739c8e29549ff37b788743a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 4 Nov 2022 11:18:30 -0300 Subject: better type signature for undefinedIfEmpty --- .../merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'packages/merchant-backoffice-ui/src/paths/admin/create') diff --git a/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx b/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx index 16f22ea4b..0d7681e1d 100644 --- a/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx @@ -33,6 +33,7 @@ import { Translate, useTranslator } from "../../../i18n/index.js"; import { DefaultInstanceFormFields } from "../../../components/instance/DefaultInstanceFormFields.js"; import { INSTANCE_ID_REGEX, PAYTO_REGEX } from "../../../utils/constants.js"; import { Amounts } from "@gnu-taler/taler-util"; +import { undefinedIfEmpty } from "../../../utils/table.js"; export type Entity = MerchantBackend.Instances.InstanceConfigurationMessage & { auth_token?: string; @@ -54,12 +55,6 @@ function with_defaults(id?: string): Partial { }; } -function undefinedIfEmpty(obj: T): T | undefined { - return Object.keys(obj).some((k) => (obj as any)[k] !== undefined) - ? obj - : undefined; -} - export function CreatePage({ onCreate, onBack, forceId }: Props): VNode { const [value, valueHandler] = useState(with_defaults(forceId)); const [isTokenSet, updateIsTokenSet] = useState(false); -- cgit v1.2.3