Props optional for h
This commit is contained in:
parent
9d01489c95
commit
461a33e467
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue