I like the tricks :) – Kasia
Avoid casting, especially to any.
const element = document.querySelector('#id') (element as any).style.display = 'block' // ⛔️ element could be null
const element = document.querySelector('#id') if (element instanceof HTMLElement) { element.style.display = 'block' }
Crafted with 💛 by Riccardo