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

---
 .../src/handlers/InputSelectMultiple.tsx                     | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

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

diff --git a/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx b/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx
index dd85453e5..8369e509d 100644
--- a/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx
+++ b/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx
@@ -4,16 +4,16 @@ import { LabelWithTooltipMaybeRequired, UIFormProps } from "./InputLine.js";
 import { useField } from "./useField.js";
 import { useState } from "preact/hooks";
 
-export function InputSelectMultiple(
+export function InputSelectMultiple<T extends object, K extends keyof T>(
   props: {
     choices: Choice[];
     unique?: boolean;
     max?: number;
-  } & UIFormProps<Array<string>>,
+  } & UIFormProps<T, K>,
 ): VNode {
   const { name, label, choices, placeholder, tooltip, required, unique, max } =
     props;
-  const { value, onChange } = useField<{ [s: string]: Array<string> }>(name);
+  const { value, onChange } = useField<T, K>(name);
 
   const [filter, setFilter] = useState<string | undefined>(undefined);
   const regex = new RegExp(`.*${filter}.*`, "i");
@@ -21,7 +21,7 @@ export function InputSelectMultiple(
     return { ...prev, [curr.value]: curr.label };
   }, {} as Record<string, string>);
 
-  const list = value ?? [];
+  const list = (value ?? []) as string[];
   const filteredChoices =
     filter === undefined
       ? undefined
@@ -44,7 +44,7 @@ export function InputSelectMultiple(
               onClick={() => {
                 const newValue = [...list];
                 newValue.splice(idx, 1);
-                onChange(newValue);
+                onChange(newValue as T[K]);
                 setFilter(undefined);
               }}
               class="group relative h-5 w-5 rounded-sm hover:bg-gray-500/20"
@@ -119,7 +119,7 @@ export function InputSelectMultiple(
                     }
                     const newValue = [...list];
                     newValue.splice(0, 0, v.value);
-                    onChange(newValue);
+                    onChange(newValue as T[K]);
                   }}
 
                   // tabindex="-1"
-- 
cgit v1.2.3

