export const getElement = (selector: string, warn = true): null | E => { const element = document.querySelector(selector); if (!element && warn) { // eslint-disable-next-line no-console console.warn(`Element not found: "${selector}"`); } return element ?? null; };