Using react hooks with Material-UI and TypeScript I'm unable to find a proper type T for the Material-UI TextField component. Therefore I am resorting to using HTMLInputElement as the RefObject T parameter because it also has a focus method.
const focus = (inputRef: RefObject<HTMLInputElement>) => {
if (inputRef.current !== null) {
inputRef.current.focus()
}
}
What replacement of HTMLInputElement will work properly for representing the TextField API in the RefObject in this case? I was hoping Material-UI would export something like "TextFieldRef" at least, but that doesn't seem to be the case.
Just to be clear I'm not using an HTMLInputElement anywhere in my code, using this is just a hack to get TypeScript to work properly with this, cause both TextField from Material-UI and HTMLInputElement have a focus method.
Thanks in advance!