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/components/form/InputPaytoForm.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'packages/merchant-backoffice-ui/src/components') diff --git a/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx b/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx index c2aa9c3e9..e8022ca15 100644 --- a/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx +++ b/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx @@ -22,6 +22,7 @@ import { h, VNode, Fragment } from "preact"; import { useCallback, useState } from "preact/hooks"; import { Translate, Translator, useTranslator } from "../../i18n/index.js"; import { COUNTRY_TABLE } from "../../utils/constants.js"; +import { undefinedIfEmpty } from "../../utils/table.js"; import { FormErrors, FormProvider } from "./FormProvider.js"; import { Input } from "./Input.js"; import { InputGroup } from "./InputGroup.js"; @@ -154,12 +155,6 @@ const targets = [ const noTargetValue = targets[0]; const defaultTarget = { target: noTargetValue, options: {} }; -function undefinedIfEmpty(obj: T): T | undefined { - return Object.keys(obj).some((k) => (obj as any)[k] !== undefined) - ? obj - : undefined; -} - export function InputPaytoForm({ name, readonly, -- cgit v1.2.3