fix: target es2018 to support node 10+
This commit is contained in:
parent
0a609a4539
commit
c83937ed96
6 changed files with 34 additions and 10 deletions
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { Component, Element, HTMLElement } from "./component";
|
||||
import { HTMLAttributes } from "./jsx";
|
||||
import { flatDeep } from "./utils";
|
||||
|
||||
/**
|
||||
* Create an HTMLElement from a custom Component.
|
||||
|
|
@ -42,7 +43,7 @@ export function createElement(
|
|||
...children: Element[]
|
||||
): HTMLElement {
|
||||
// Flatten the children array so we can accept arrays as children.
|
||||
const normalizedChildren = children.flat();
|
||||
const normalizedChildren = flatDeep(children);
|
||||
if (type instanceof Function) {
|
||||
return type({ ...props, children: normalizedChildren });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue