FieldTemplateProps requires keyName
Detect
- In your code: an object of
FieldTemplatePropsorWrapIfAdditionalTemplatePropsyou build yourself, such as in a custom field that renders aFieldTemplate. - In your code: a custom
FieldTemplatethat lists the props it forwards toWrapIfAdditionalTemplateone by one. - In the type checker:
Property 'keyName' is missing in type '{ schema: JSONSchema7; … }' but required in type '{ fieldPath: FieldPath; id: string; … }'., under aTS2322assignment error or aTS2769"No overload matches this call." on the JSX element.
Change
keyName: string is the name of the field's property in its parent object. It carries none of the decoration label may have, such as a ui:title or the (deprecated) marker the default deprecatedHandling appends, so an additionalProperties key is read and renamed from the real key. Rendering a FieldTemplate is unchanged. Supply it where you build the props:
<FieldTemplate
{...templateProps}
label={label}
+ keyName={name}
/>
A FieldTemplate that forwards props one by one also forwards hasErrors (Custom templates take their error state from hasErrors) and propertyNamesEnum (A custom FieldTemplate handles propertyNamesEnum).
Verify
- Your code compiles, and an additional property's key input shows and renames the real key.
Also read: