updated type for querySelecors
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vikingowls-ts-snippets",
|
"name": "vikingowls-ts-snippets",
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"description": "Vikingowls typescript snippets library",
|
"description": "Vikingowls typescript snippets library",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -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)
|
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)]
|
return [...parent.querySelectorAll(selector)]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user