export function expectEl( query: string, rootEl: Element | Document = document, ): T { const el = rootEl.querySelector(query); if (!el) { throw new Error(`[expectEl] Can't find \`${query}\` element`); } return el; } export function expectEls( query: string, rootEl: Element | Document = document, ): T[] { const els = rootEl.querySelectorAll(query); return Array.from(els); }