joegasewicz / react-bare-forms

A bare minimal React form library for quick & simple forms.
https://joegasewicz.github.io/react-bare-forms/
MIT License
20 stars 4 forks source link

TS2741: Property 'translate' is missing in type '{ ref: RefObject<HTMLFormElement>; #143

Closed joegasewicz closed 3 years ago

joegasewicz commented 3 years ago

Error:

 TS2741: Property 'translate' is missing in type '{ ref: RefObject<HTMLFormElement>; name: string; hint: string; labeltext: string; validators: IValidationFunction[]; }' but required in type 'Pick<IFileField, "children" | "type" | "name" | "form" | "style" | "title" | "pattern" | "color" | "height" | "translate" | "width" | "defaultChecked" | "defaultValue" | ... 274 more ... | "value">'.

React version:

 "@types/react": "^16.9.11",
"@types/react-dom": "^16.9.3",
 "react": "^16.11.0",
"react-dom": "^16.11.0",

FileField is causing the error :

<FileField
        ref={teacherVideoClipRef}
        name="teacher_vid"
        hint="A short video of you. Must be an mpeg"
        labeltext="A short video of you"
        validators={[isFile()]}
    />
joegasewicz commented 3 years ago

Temporary fix:

Add the translate prop:

 <FileField
      ref={teacherVideoClipRef}
      name="teacher_vid"
      hint="A short video of you. Must be an mpeg"
      labeltext="A short video of you"
      validators={[isFile()]}
      translate={null}
  />
joegasewicz commented 3 years ago

The fix should update IFileField interface to set / override the translate attribute as an optional property