From 61aedb36351b615ac00cef49bf0914752e9ad636 Mon Sep 17 00:00:00 2001 From: Jacob Bolda Date: Mon, 4 Dec 2023 22:13:06 -0600 Subject: [PATCH] coerce field types --- .../src/components/Form/Form.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/scaffolder-frontend-workflow/src/components/Form/Form.tsx b/plugins/scaffolder-frontend-workflow/src/components/Form/Form.tsx index 716b1a9dd0..ab51769b9c 100644 --- a/plugins/scaffolder-frontend-workflow/src/components/Form/Form.tsx +++ b/plugins/scaffolder-frontend-workflow/src/components/Form/Form.tsx @@ -1,5 +1,5 @@ -import { JsonValue } from '@backstage/types'; -import { type IChangeEvent } from '@rjsf/core'; +import type { JsonValue } from '@backstage/types'; +import type { IChangeEvent } from '@rjsf/core'; import React, { useCallback, useMemo, type ReactNode } from 'react'; import validator from '@rjsf/validator-ajv8'; import { RJSFForm, type RJSFFormProps } from './RJSFForm'; @@ -10,6 +10,7 @@ import { } from '@backstage/plugin-scaffolder-react/alpha'; import type { FieldExtensionOptions } from '@backstage/plugin-scaffolder-react'; +import type { RJSFSchema, RegistryFieldsType } from '@rjsf/utils'; export type FormProps = { extensions: FieldExtensionOptions[]; @@ -37,7 +38,7 @@ export const Form = ({ const fields = useMemo(() => { return Object.fromEntries( extensions.map(({ name, component }) => [name, component]), - ); + ) as RegistryFieldsType; }, [extensions]); const handleChange = useCallback( @@ -59,8 +60,6 @@ export const Form = ({ validator={validator} schema={step.schema} uiSchema={step.uiSchema} - // TODO fix TS - // @ts-expect-error fields={fields} formData={formData} formContext={{ formData }}