Fixed element typings

This commit is contained in:
squidfunk
2019-12-19 09:48:16 +01:00
parent 63c8544371
commit 6b1ff5ef1d
4 changed files with 24 additions and 13 deletions

View File

@@ -83,7 +83,7 @@ function appendChild(el: Element, child: Child): void {
export function h(
tag: string, attributes: Attributes | null,
...children: Array<Element | Text | string | number>
) {
): Element {
const el = document.createElement(tag)
/* Set attributes, if any */
@@ -102,6 +102,17 @@ export function h(
return el
}
/**
* JSX factory wrapper
*
* @param el - JSX element
*
* @return Element
*/
export function toElement(el: JSXInternal.Element): Element {
return el as any // Hack: if you have a better idea, PR!
}
/* ----------------------------------------------------------------------------
* Namespace
* ------------------------------------------------------------------------- */