| 1 | /** |
| 2 | * @template { HTMLElement } T |
| 3 | * @param { Document | Element | ShadowRoot } raiz |
| 4 | * @param { string } query |
| 5 | * @returns { T } |
| 6 | */ |
| 7 | export function querySelector(raiz, query) { |
| 8 | /** @type { T | null } */ |
| 9 | const resutado = raiz.querySelector(query) |
| 10 | if (resutado === null) |
| 11 | throw new Error(`No se encuentra ${query}.`) |
| 12 | return resutado |
| 13 | } |