Skip to content

Commit

Permalink
coerce field types
Browse files Browse the repository at this point in the history
  • Loading branch information
jbolda committed Dec 5, 2023
1 parent 4deeca3 commit 61aedb3
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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<any, any>[];
Expand Down Expand Up @@ -37,7 +38,7 @@ export const Form = ({
const fields = useMemo(() => {
return Object.fromEntries(
extensions.map(({ name, component }) => [name, component]),
);
) as RegistryFieldsType<any, RJSFSchema, any>;
}, [extensions]);

const handleChange = useCallback(
Expand All @@ -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 }}
Expand Down

0 comments on commit 61aedb3

Please sign in to comment.