reuse ViewNode in Child type

This commit is contained in:
Bruno Windels 2021-09-16 15:39:25 +02:00
parent 040efa970c
commit ea4d833a43

View file

@ -17,9 +17,11 @@ limitations under the License.
// DOM helper functions
import {ViewNode} from "./types";
export type ClassNames<T> = { [className: string]: boolean | ((value: T) => boolean) }
export type BasicAttributes<T> = { [attribute: string]: ClassNames<T> | boolean | string }
export type Child = string | Text | Element
export type Child = string | Text | ViewNode;
export function isChildren(children: object | Child | Child[]): children is Child | Child[] {
// children should be an not-object (that's the attributes), or a domnode, or an array