// Generische Helferfunktion zum Selektieren von Element mit Überprüfung, ob das Element existiert export const querySelectorTyped = ( selector: string, parent: Element | Document = document, ): T => { const element = parent.querySelector(selector); if (!element) { throw new Error(`Element with selector "${selector}" not found.`); } return element; };