@@ -354,6 +354,7 @@ export function computeDefaults<T = any, S extends StrictRJSFSchema = RJSFSchema
354354
355355/**
356356 * Ensure that the formData matches the given schema. If it's not matching in the case of a selectField, we change it to match the schema.
357+ *
357358 * @param validator - an implementation of the `ValidatorType` interface that will be used when necessary
358359 * @param schema - The schema for which the formData state is desired
359360 * @param rootSchema - The root schema, used to primarily to look up `$ref`s
@@ -383,7 +384,7 @@ export function ensureFormDataMatchingSchema<
383384 // Override the formData with the const if the constAsDefaults is set to always
384385 const constTakesPrecedence = schema [ CONST_KEY ] && experimental_defaultFormStateBehavior ?. constAsDefaults === 'always' ;
385386 if ( constTakesPrecedence ) {
386- validFormData = schema . const as any ;
387+ validFormData = schema . const as T ;
387388 }
388389
389390 return validFormData ;
@@ -704,8 +705,8 @@ export default function getDefaultFormState<
704705 if ( isObject ( formData ) || Array . isArray ( formData ) ) {
705706 const { mergeDefaultsIntoFormData } = experimental_defaultFormStateBehavior || { } ;
706707 const defaultSupercedesUndefined = mergeDefaultsIntoFormData === 'useDefaultIfFormDataUndefined' ;
707- const result = mergeDefaultsWithFormData < T > (
708- defaults as T ,
708+ const result = mergeDefaultsWithFormData < T | T [ ] > (
709+ defaults ,
709710 formData ,
710711 true , // set to true to add any additional default array entries.
711712 defaultSupercedesUndefined ,
0 commit comments