fix: target es2018 to support node 10+

This commit is contained in:
M. George Hansen 2020-05-26 16:29:43 -07:00
parent a320962aa8
commit d6b7e9eb95
Signed by: mgeorgehansen
SSH key fingerprint: SHA256:JlIGiQLPyQ2RHTH3a2oVlb20Xkh9Glr8DUF4YTXHJxM
6 changed files with 34 additions and 10 deletions

View file

@ -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 });
}