I would like to trigger a click event on a HTML element in Typescript/Reactjs.
let element: Element = document.getElementsByClassName('btn')[0];
element.click();
The code above does work. But I'm getting a Typescript error:
ERROR in [at-loader] ./src/App.tsx:124:17
TS2339: Property 'click' does not exist on type 'Element'.
So what would be the correct way to do this?