I am getting an error while converting the following code to typescript.
const element = document.querySelector('#launcher');
if (element && element.style && element.style.display) {
element.style.display = '';
}
error TS2339: Property 'style' does not exist on type 'Element'.
and when I assign required values for same as like below
const element: { style: any } = document.querySelector('#launcher');
then the error is on the element and that is
error TS2322: Type 'Element | null' is not assignable to type '{ style: any; }'. Type 'null' is not assignable to type '{ style: any; }'.