As I embark on my first React TypeScript project, I came across a sample written in pure JavaScript and now I want to rewrite it using TypeScript.
In the Firebase JavaScript sample, we can see:
addCommentForm.onsubmit = function(e) {
e.preventDefault();
createNewComment(postId, firebase.auth().currentUser.displayName, uid, commentInput.value);
commentInput.value = '';
commentInput.parentElement.MaterialTextfield.boundUpdateClassesHandler();
};
For my TypeScript version, I aim to create a function similar to this:
function resetMaterialTextfield(element: HTMLInputElement) {
element.value = '';
element.parentNode.MaterialTextfield.boundUpdateClassesHandler();
}
The burning question on my mind:
How should I define 'element' with the appropriate type that has attributes like parentNode, parentElement, and contains MaterialTextfield for calling boundUpdateClassesHandler()?
Where does the MaterialTextfield originate from? What is its type and where can I access documentation or tutorials related to this class and library?