I would like to avoid using a type of any and I can't find what type definition am I supposed to use for it:
const iframe = useRef<any>();
<iframe
ref={iframe}
sandbox='allow-scripts'
srcDoc={rootHtml}
/>
So that later Typescript can recognize properties of iframe.current such as
iframe.current.contentWindow and iframe.current.srcdoc,...
*Edit
If I try using HTMLIFrameElement as suggested I receive this error under the ref={iframe} saying:
Type 'MutableRefObject<HTMLIFrameElement | undefined>' is not >assignable to type 'LegacyRef | undefined'. Type 'MutableRefObject<HTMLIFrameElement | undefined>' is not >assignable to type 'RefObject'. Types of property 'current' are incompatible. Type 'HTMLIFrameElement | undefined' is not assignable to type >'HTMLIFrameElement | null'. Type 'undefined' is not assignable to type 'HTMLIFrameElement | >null'.ts(2322)