Skip to content

Commit

Permalink
Add types to form input wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
langdal committed Sep 22, 2021
1 parent dab2eef commit 1ace24a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions utility/forms/form-input.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { TextField } from "@material-ui/core"
import { TextField, TextFieldProps } from "@material-ui/core"
import React from "react"
import { Controller } from "react-hook-form"

const FormInputText = ({ name, control, defaultValue = undefined, rules = {}, transform = (x:any) => x, ...rest }) => (
type FormInputTextPropType = {
name: string
control: any
defaultValue?: any
rules?: any
transform?: (x:any) => any
}

const FormInputText = ({ name, control, defaultValue = undefined, rules, transform = (x:any) => x, ...rest }: FormInputTextPropType & TextFieldProps) => (
<Controller
name={name}
control={control}
Expand Down

0 comments on commit 1ace24a

Please sign in to comment.