hHow can get it that change JSX.Element to HTMLElement
//.tsx
const Fuga: React.FC<{}> = (props) => {
//Script
const target: HRMLElement = document.getElementById("hoge");
// Error: Type 'Element' is missing the following properties from type 'HTMLElement'
// "hoge" is JSX.Element
const target: HTMLElement = document.getElementById("hoge") as HTMLElement;
//no Error
return <div id="hoge"></div>
}
#TypeScript
#React
#Gatsby.js