diff --git a/pkgs/webview-ui/app/src/Form/fields/Select.tsx b/pkgs/webview-ui/app/src/Form/fields/Select.tsx index b059a81c9..b58f5c4c8 100644 --- a/pkgs/webview-ui/app/src/Form/fields/Select.tsx +++ b/pkgs/webview-ui/app/src/Form/fields/Select.tsx @@ -12,7 +12,11 @@ import { Label } from "../base/label"; import { useFloating } from "../base"; import { autoUpdate, flip, hide, shift, size } from "@floating-ui/dom"; -export type Option = { value: string; label: string }; +export interface Option { + value: string; + label: string; +} + interface SelectInputpProps { value: string[] | string; selectProps: JSX.InputHTMLAttributes; @@ -81,7 +85,7 @@ export function SelectInput(props: SelectInputpProps) { const handleClickOption = (opt: Option) => { if (!props.multiple) { - // @ts-ignore + // @ts-expect-error: fieldName is not known ahead of time props.selectProps.onInput({ currentTarget: { value: opt.value, @@ -96,7 +100,7 @@ export function SelectInput(props: SelectInputpProps) { } else { currValues.push(opt.value); } - // @ts-ignore + // @ts-expect-error: fieldName is not known ahead of time props.selectProps.onInput({ currentTarget: { options: currValues.map((value) => ({ @@ -128,17 +132,17 @@ export function SelectInput(props: SelectInputpProps) { {props.adornment?.content} {props.inlineLabel} -
+
{(item) => ( -
+
{item} @@ -396,7 +398,7 @@ export function ListValueDisplay( ); } -const findDuplicates = (arr: any[]) => { +const findDuplicates = (arr: unknown[]) => { const seen = new Set(); const duplicates: number[] = []; @@ -475,20 +477,19 @@ export function ArrayFields( when={itemsSchema().type === "string" && itemsSchema().enum} > { let error = ""; - // @ts-ignore - const values: any[] = getValues( + const values: unknown[] = getValues( props.formStore, - // @ts-ignore + // @ts-expect-error: listFieldName is not known ahead of time listFieldName, - // @ts-ignore + // @ts-expect-error: assumption based on the behavior of selectInput )?.strings?.selection; console.log("vali", { values }); if (props.schema.uniqueItems) { @@ -543,17 +544,17 @@ export function ArrayFields( > {/* !Important: Register the parent field to gain access to array items*/} { let error = ""; - // @ts-ignore - const values: any[] = getValues( + // @ts-expect-error: listFieldName is not known ahead of time + const values: unknown[] = getValues( props.formStore, - // @ts-ignore + // @ts-expect-error: listFieldName is not known ahead of time listFieldName, ); if (props.schema.uniqueItems) { @@ -596,7 +597,7 @@ export function ArrayFields( of={fieldArray.items.length} > {(f, fp) => ( @@ -642,25 +643,29 @@ export function ArrayFields( }} // Add the new item to the FieldArray handleSubmit={(values, event) => { - // @ts-ignore - const prev: any[] = getValues( + // @ts-expect-error: listFieldName is not known ahead of time + const prev: unknown[] = getValues( props.formStore, - // @ts-ignore + + // @ts-expect-error: listFieldName is not known ahead of time listFieldName, ); if (itemsSchema().type === "object") { const newIdx = prev.length; setValue( props.formStore, - // @ts-ignore + + // @ts-expect-error: listFieldName is not known ahead of time `${listFieldName}.${newIdx}`, - // @ts-ignore + + // @ts-expect-error: listFieldName is not known ahead of time values.root, ); } - // @ts-ignore + + // @ts-expect-error: listFieldName is not known ahead of time insert(props.formStore, listFieldName, { - // @ts-ignore + // @ts-expect-error: listFieldName is not known ahead of time value: values.root, }); }} @@ -685,7 +690,7 @@ interface ObjectFieldPropertyLabelProps { export function ObjectFieldPropertyLabel(props: ObjectFieldPropertyLabelProps) { return ( - {/* @ts-ignore */} + {/* @ts-expect-error: $exportedModuleInfo should exist since we export it */} {(path) => path()[path().length - 1]} @@ -724,6 +729,7 @@ export function ObjectFields( {([propName, propSchema]) => (
( {(itemSchema) => ( {(objectField, fp) => ( @@ -802,11 +808,11 @@ export function ObjectFields( > {([key, relatedValue]) => ( {(f, fp) => ( -
+
( {key}