updated type for querySelecors

This commit is contained in:
2022-04-25 17:15:36 +02:00
parent d6eb60edcc
commit 0039e54de2
2 changed files with 3 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "vikingowls-ts-snippets",
"version": "0.0.3",
"version": "0.0.4",
"description": "Vikingowls typescript snippets library",
"main": "./dist/index.js",
"scripts": {

View File

@@ -15,10 +15,10 @@ export const addGlobalEventListener = (
)
}
export const qs = (selector: string, parent = document): Element => {
export const qs = (selector: keyof HTMLElementTagNameMap, parent = document): Element => {
return parent.querySelector(selector)
}
export const qsa = (selector: string, parent = document): Element[] => {
export const qsa = (selector: keyof HTMLElementTagNameMap, parent = document): Element[] => {
return [...parent.querySelectorAll(selector)]
}