Ensuring Type Safety around FieldComponents ? #1327
Unanswered
PrinceGupta1999
asked this question in
Q&A
Replies: 1 comment
-
You can add an additional prop to your TextField component called value that only accepts the correct type. <form.AppField
name="age" // number field
children={(field) => <field.TextField label="Age" value={field.state.value} />}
/> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When defining field components like in this example, how can I ensure type safety that the TextField can only be used with fields whose value is text.
We are currently manually adding the type as
However when using this component in a form like:
There will be no type errors. We will only find in runtime that the number was transformed into a string.
Beta Was this translation helpful? Give feedback.
All reactions