template T param selector param node returns export function getElements < T extends keyof HTMLElementTagNameMap > ( selector , node ? ) ; export function getElements < T extends HTMLElement > ( selector , node ? ) ; export function getElements < T extends HTMLElement > ( selector , node = document ) { return Array . from ( node . querySelectorAll < T > ( selector ) ) ; } template T param selector param node returns export function getElement < T extends keyof HTMLElementTagNameMap > ( selector , node ? ) ; export function getElement < T extends HTMLElement > ( selector , node ? ) ; export function getElement < T extends HTMLElement > ( selector , node = document ) { const el = getOptionalElement < T > ( selector , node ) ; if ( typeof el === "undefined" ) throw new ReferenceError ( `Missing element: expected "${ selector }" to be present` ) ; return el ; } template T param selector param node returns export function getOptionalElement < T extends keyof HTMLElementTagNameMap > ( selector , node ? ) ; export function getOptionalElement < T extends HTMLElement > ( selector , node ? ) ; export function getOptionalElement < T extends HTMLElement > ( selector , node = document ) { return node . querySelector < T > ( selector ) || undefined ; } returns export function getActiveElement ( ) { return document . activeElement instanceof HTMLElement ? document . activeElement || undefined : undefined ; }