Props optional for h

This commit is contained in:
Tangent Wantwight 2024-01-23 23:27:41 -05:00
parent 9d01489c95
commit 461a33e467

View file

@ -1,6 +1,6 @@
export function h<Name extends keyof HTMLElementTagNameMap>( export function h<Name extends keyof HTMLElementTagNameMap>(
name: Name, name: Name,
props: Partial<HTMLElementTagNameMap[Name]>, props: Partial<HTMLElementTagNameMap[Name]> = {},
...children: (Node | string)[] ...children: (Node | string)[]
): HTMLElementTagNameMap[Name] { ): HTMLElementTagNameMap[Name] {
const element = Object.assign(document.createElement(name), props); const element = Object.assign(document.createElement(name), props);