We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent104a3c6 commitcf8a20dCopy full SHA for cf8a20d
site/src/components/Form/index.ts
@@ -17,8 +17,13 @@ interface FormHelpers {
17
helperText?:string
18
}
19
20
-exportconstgetFormHelpers=<T>(form:FormikContextType<T>,name:string,error?:string):FormHelpers=>{
21
-// getIn is a util function from Formik that gets at any depth of nesting, and is necessary for the types to work
+exportconstgetFormHelpers=<T>(form:FormikContextType<T>,name:keyofT,error?:string):FormHelpers=>{
+if(typeofname!=="string"){
22
+thrownewError(`name must be type of string, instead received '${typeofname}'`)
23
+}
24
+
25
+// getIn is a util function from Formik that gets at any depth of nesting
26
+// and is necessary for the types to work
27
consttouched=getIn(form.touched,name)
28
consterrors=error??getIn(form.errors,name)
29
return{