I am using Material-UI's TextField
in conjunction with react-hook-form
to watch inputs.
I have noticed that regardless of the type of the input, a string is returned.
This clashes with the types I use in the codebase.
I have read about different ways to handle this issue on react-hook-form
's side, with transforming the returned data but I couldn't find anything about making TextField return a different type depending on how it's used.
I'm especially surprised because as far as I understand, valueAsNumber
exists natively on HTML inputs (https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement)