From 3e95ae356a98d01e523bdf48547db4114ff224fe Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 22 May 2023 10:40:13 -0300
Subject: fix break on build

---
 .../exchange-backoffice-ui/src/handlers/InputSelectOne.tsx | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

(limited to 'packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx')

diff --git a/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx b/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx
index a4ed1ba1c..9af446e6c 100644
--- a/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx
+++ b/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx
@@ -4,15 +4,13 @@ import { LabelWithTooltipMaybeRequired, UIFormProps } from "./InputLine.js";
 import { useField } from "./useField.js";
 import { useState } from "preact/hooks";
 
-export function InputSelectOne(
+export function InputSelectOne<T extends object, K extends keyof T>(
   props: {
     choices: Choice[];
-  } & UIFormProps<Array<string>>,
+  } & UIFormProps<T, K>,
 ): VNode {
   const { name, label, choices, placeholder, tooltip, required } = props;
-  const { value, onChange } = useField<{ [s: string]: string | undefined }>(
-    name,
-  );
+  const { value, onChange } = useField<T, K>(name);
 
   const [filter, setFilter] = useState<string | undefined>(undefined);
   const regex = new RegExp(`.*${filter}.*`, "i");
@@ -35,11 +33,11 @@ export function InputSelectOne(
       />
       {value ? (
         <span class="inline-flex items-center gap-x-0.5 rounded-md bg-gray-100 p-1 mr-2 font-medium text-gray-600">
-          {choiceMap[value]}
+          {choiceMap[value as string]}
           <button
             type="button"
             onClick={() => {
-              onChange(undefined);
+              onChange(undefined!);
             }}
             class="group relative h-5 w-5 rounded-sm hover:bg-gray-500/20"
           >
@@ -103,7 +101,7 @@ export function InputSelectOne(
                     role="option"
                     onClick={() => {
                       setFilter(undefined);
-                      onChange(v.value);
+                      onChange(v.value as T[K]);
                     }}
 
                     // tabindex="-1"
-- 
cgit v1.2.3

